Greedy algorithm stays ahead.
Show that after each step of the greedy algorithm, its solution is at least as good as other algorithm’s.
Ex.Interval scheduling
Structural.
Discover a simple “structural” bound asserting that every possible solution must have a certain value. Then show that your algorithm always achieves this bound.
Ex.Interval partitioning
Exchange argument
Gradually transform any solution to the one found by the greedy algorithm without hurting its quality.
Ex.Minimizing lateness
Remark.
Greedy algorithm do not always give an optimal solution but can produce a solution that is guaranteed to be close to optimal.
Basic Elements of Greedy Algorithm
Usually, if the given problem has the following ingredients(hallmark in other teaching material, Steve add this note), then it is more likely to develop a greedy algorithm for it.
Greedy-choice property.
A locally optimal choice is globally optimal。
We can assemble a globally optimal solution by making locally optimal(greedy) choices. That is, when we make the choice that looks best in the current problem, without considering results from subproblems.
Optimal substructure.
A problem exhibits optimal substructure if an optimal solution to the problem contain within it optimal solutions to subproblems.