Huffman Coding

David A. Huffman, 1952

O(n log n)

Huffman's greedy algorithm constructs a full binary tree whose leaves are symbols weighted by frequency; merging the two smallest partial trees at each step yields a minimum-redundancy prefix-free code. The canvas shows symbol chips, the evolving forest laid out side by side, and merged parents in gold.