05_greedy_algorithms
05_greedy_algorithms
## Concept
- Make locally optimal choices at each step
- Goal: Find global optimum through local optima
- Does not always lead to global optimal solution
- Often simpler and more efficient than DP when applicable
- Prim's Algorithm:
* Start from any vertex
* Add minimum weight edge to expand tree
* Uses priority queue
* Time complexity: O(E log V) with binary heap
## Practice Problems:
1. Fractional knapsack (greedy) vs. 0/1 knapsack (DP)
2. Minimum number of coins for change (when greedy works)
3. Job sequencing with deadlines
4. Implementing Huffman coding for text compression