Greedy Algorithms


Kinds of Knapsack Problems

Fractional Knapsack: Greedy Solution

Greedy Algorithms Don't Work for 0-1 Knapsack Problems

Greedy vs DP (Overview)

Another Greedy Algorithm: Huffman Coding

Prefix Code

Huffman Coding Example

Codes as Trees

Huffman Code Algorithm

Another Greedy Algorithm: Activity Selection


Optimal Substructure

DP Solutions

A Greedy Solution

Formalizing the Greedy Approach

Recursive Greedy Solution

Iterative Greedy Algorithm

Greedy vs Dynamic Programming (1)

Greedy vs Dynamic Programming (2)