# Greedy Algorithms Confidence: high Last verified: 2026-05-22 Generation: human_only ## TL;DR Greedy algorithms make locally optimal choices hoping for global optimum. Fast but require correctness proof. Examples: Huffman coding, Prim/Kruskal (MST), activity selection, fractional knapsack. ## Core Explanation Greedy choice property: locally optimal choice leads to globally optimal solution. Proof via exchange argument: any optimal solution can be transformed to include the greedy choice. Prim's: grow MST by adding nearest vertex (O(E log V)). Kruskal's: sort edges, union-find to avoid cycles (O(E log E)). ## Further Reading - [Introduction to Algorithms (CLRS)](undefined)