Notes

Source: 📖 Problem Solving with Algorithms and Data Structures using Python 8.22


What is a greedy algorithm?

A greedy algorithm takes the most cost-efficient (cheapest) option at every step. For example, in a graph path finding algorithm, a greedy variety would always opt to follow the edge with the lowest weight. Examples of greedy algorithms are Dijkstra's algorithm and Prim's algorithm.