Why it matters
Activity selection is greedy classic. Understanding shapes greedy proofs.
Advertisement
The architecture
Sort by finish time.
Pick earliest.
Skip overlapping; repeat.
Advertisement
How it works end to end
Exchange argument for optimality.
Sort O(n log n); scan O(n).
Weighted variant needs DP.