Learn to solve optimization problems by making the best local choice at each step. Master the greedy approach and understand when it leads to globally optimal solutions.
A globally optimal solution can be reached by making locally optimal choices
An optimal solution contains optimal solutions to subproblems
Once a choice is made, it is never reconsidered or undone
Show that any optimal solution can be transformed to greedy solution without losing optimality
Activity Selection: Exchange any activity with later finish time for earlier one
Remove part of optimal solution and replace with greedy choice
Fractional Knapsack: Replace any item with lower ratio with higher ratio item
Prove greedy algorithm always maintains better or equal state than any other algorithm
Dijkstra: Greedy distances are always ≤ actual shortest distances
Activity selection, job scheduling with deadlines
MST (Kruskal, Prim), shortest path (Dijkstra)
Fractional knapsack, Huffman coding
Coin change for standard currencies
Cannot take fractions - need DP instead
Greedy choices don't lead to global optimum
Example: coins [1, 3, 4] for amount 6
Nearest neighbor heuristic not optimal
Visualize greedy choices and see how local optimizations lead to global solutions