Locally optimal choices building global solutions — scheduling, Huffman codes, and more.
4 visualizations
Selects the maximum number of non-overlapping activities by always taking the one that finishes earliest.
Maximizes value under a weight limit when items can be split, by greedily taking the highest value/weight ratio first.
Schedules unit-time jobs to maximize profit by taking the most profitable jobs first and placing them in the latest free slot before their deadline.
Builds an optimal prefix-free binary code by repeatedly merging the two lowest-frequency nodes into a tree.