This page is the module index for greedy algorithms.
greedy/classic.py— interval scheduling, fractional knapsack, Huffman codes.
Industry
A working engineer uses a min-heap when the greedy choice is the lightest
remaining weight. Huffman coding in this module repeatedly takes the two
lightest weights with heapq.heappop. Python documents a min-heap whose
smallest item is heap[0], and heappop returns that item.