Skip to Content
Mini Arrow Down Icon
Loading menu bar
Loading menu bar
Codecademy Logo
Cheatsheets
/
Graphs and Graph Traversal
Greedy Algorithms: Dijkstra's Algorithm
Download Icon
Print
Cheatsheet
Share Icon
Share
Arrow Chevron Down Filled Icon
Topics
Arrow Chevron Down Icon
Graphs and Graph Search
Greedy Algorithms: Dijkstra's Algorithm
Greedy Algorithms
A greedy algorithm solves an optimization problem by making the best decision at each step. This is known as the
locally optimal
decision.
Greedy algorithms are simple and efficient but are
NOT
always correct.
In order for a greedy algorithm to work, a problem must satisfy:
The optimal substructure property
The greedy property
Mini Arrow Left Icon
Previous
Download Icon
Print
Cheatsheet
Share Icon
Share
Arrow Chevron Down Filled Icon