Greedy Algorithms8 sections · 316 units
Open in Course

How to Practice Greedy

Building intuition

Greedy problems require intuition. You need to recognize when greedy works and what the greedy criterion should be. The best way to build this intuition is deliberate practice:

1.1. Try greedy first.: For any optimization problem, ask: what is the locally optimal choice?

2.2. Find counterexamples.: If greedy fails, construct a case where the greedy choice leads to a suboptimal answer.

3.3. Prove or disprove.: Use exchange argument or stays-ahead to verify your greedy approach.

4.4. Recognize patterns.: Activity selection, interval covering, and scheduling appear in many disguises.