Labs / Computer Science
Huffman Coding
Type a message and watch the two rarest symbols keep merging until a whole tree of codes appears. Common letters end up near the top with short codes, rare ones sink deep with long codes — and the total shrinks below plain 8-bit ASCII. Drag across the letters to trace any character's path of 0s and 1s.
merges 0/0Huffman 0 bitsASCII 0 bitsratio —code —
What to try
- Scrub the build step back to zero. Which two nodes merge first, and why those two?
- In "mississippi", which letter gets the shortest code? Is it the one you'd guess?
- Type a message where every letter appears the same number of times. Do the codes still beat 8-bit ASCII?
- Why does the most frequent character sit closest to the root of the tree?
- How high can you push the compression ratio — and what kind of text gets you there?