A greedy algorithm follows the heuristic of making the locally optimal choice at every decision point. In general, greedy algorithms are not guaranteed to produce a globally optimal solution. A greedy algorithm is not exhaustive and does not reconsider its decisions. This means that a greedy algorithm can only guarantee a correct solution for problems which have the greedy choice property, which states that for every locally optimal decision, there exists a solution consistent with this choice.

An example greedy algorithm to solve the travelling salesman problem explores the closest unvisited node at every point.