March 24
Greedy
What greedy means, when the best local choice helps reach the right answer, and why that does not always work.
What it is
Greedy is a strategy that picks the best-looking move right now.
The bet is that this local choice will lead to a good global answer.
When to use it
It appears when:
- the current decision can be made without exploring every future combination
- the problem structure really supports that local choice
Common mistake
The classic mistake is treating greedy like a universal shortcut.
People often try greedy where the problem actually needs dynamic programming, search, or backtracking.
Better question
Before using it, ask:
- why does the best local move remain safe later?
- is there a small counterexample that breaks the intuition?
- can I justify the choice, or am I just hoping?
Share this page
Copy the link manually from the field below.