greedy-algorithms
3 free lessons tagged greedy-algorithms across Computer Science. Each one is a short sequence of focused steps with narration and a five-question quiz at the end — take them in any order, no signup required.
Which Technique Applies, and How to Tell
A procedure for deciding between greedy, dynamic programming, and neither. Write the recurrence, count the states, attempt the greedy proof, and read the failure. Includes the instance where greedy is optimal and off by a third depending on one word in the problem statement.
Greedy: Proving a Local Choice Is Globally Right
A greedy algorithm is three lines of code and a proof. This lesson covers the proof techniques that make it an algorithm rather than a heuristic: the exchange argument, greedy-stays-ahead, Huffman's merge, and the matroid theorem that says exactly when greedy is guaranteed.
Optimal Substructure: The Property Both Techniques Need
Dynamic programming and greedy algorithms both rest on a structural property the problem either has or does not have. This lesson establishes it precisely, shows a problem that lacks it, and separates the three properties that decide which technique applies.

