In optimization, a greedy algorithm is an approach that tries to make the most locally optimal decision at each point in time.