juniorGreedy Algorithms
What is a Greedy Algorithm?
Updated Apr 28, 2026
Short answer
An algorithm that makes the locally optimal choice at each step with the hope of finding a global optimum.
Deep explanation
Greedy algorithms are defined by the 'Greedy Choice Property'. An algorithm that makes the locally optimal choice at each step with the hope of finding a global optimum. Unlike backtracking, once a choice is made, it is never reconsidered.
Real-world example
Giving change with the fewest coins in a standard currency.
Common mistakes
- Assuming greedy works for all optimization problems without proof.
Follow-up questions
- Is Greedy always faster than DP?