Huffman Tree Builder

Build the coding tree by repeatedly merging the two lowest weights. The lower child goes left and gets bit 0; the higher child goes right and gets bit 1.

step 1 / 6

Initial frequencies

Start with each symbol as its own one-node tree.

no merge yet

Codes at the final step