Greedy Algorithm
Version 1.0.0 · Updated 2026-07-28
CORE DEFINITION
A greedy algorithm is an algorithmic paradigm that follows the problem solving heuristic of making the locally optimal choice at each stage with the hope of finding a global optimum. For example, in the traveling salesman problem, if the salesman always chooses the nearest city, that is a greedy algorithm. Greedy algorithms are particularly effective for problems with optimal substructure, meaning that local optimal solutions can determine the global optimal solution. Simply put, the problem can be broken down into subproblems, and the optimal solutions to subproblems can be recursively extended to the optimal solution of the overall problem. The difference between greedy algorithms and dynamic programming is that greedy algorithms make a choice for each subproblem and cannot backtrack, whereas dynamic programming saves previous computation results and uses them to make current choices, allowing backtracking. Greedy methods can solve some optimization problems, such as finding the minimum spanning tree in a graph and Huffman coding. For other problems, greedy methods generally cannot produce the desired answer. Once a problem can be solved by a greedy method, it is usually the best approach.
SCAFFOLDING EFFECT
Reduce cognitive load
A greedy algorithm is an algorithmic paradigm that follows the problem solving heuristic of making the locally optimal choice at each stage with the hope of finding a global optimum. For example, in the traveling salesman problem, if the salesman always chooses the nearest city, that is a greedy algorithm. Greedy algorithms are particularly effective for problems with optimal substructure, meaning that local optimal solutions can determine the global optimal solution.
Anchor fast decisions
A greedy algorithm makes the locally optimal decision at each step, expecting to achieve a global optimum. It is efficient but does not guarantee optimality; it is only valid for problems that satisfy the greedy choice property and optimal substructure.
MINIMUM ACTION
In progress 0/1Practice this model in one real situation:
account_treeGenealogyexpand_more
menu_bookReferencesexpand_more
Source support: Explicit
- zh.wikipedia.orghttps://zh.wikipedia.org/wiki/%E8%B4%AA%E5%BF%83%E7%AE%97%E6%B3%95verified
PRIVATE NOTES · Only visible to you
SAVED Q&A
ENTRY Q&A · Private saving available
Ask with a clear boundary
thinkingmodels answers from published entry context only.
Your question is sent to thinkingmodels. The answer uses public entry context only.
RELATED MODELS