Tinker Compression

by Samy (Kondasamy Jayaraman) · drawn with Colorfigures by April Zhu

7 piles left to merge.7 piles

Chapter 3 of 7

Short codes for common letters

Every letter still costs eight bits, the common ones as much as the rare. What if common letters got shorter codes?

This chapter: How does Huffman’s rule give the commonest letters the shortest codes?

About this chapter

You will learn

  • Merge the two lightest piles, again and again
  • Each merge adds one bit to the letters inside
  • Ties can go either way and still be best

Words you’ll meet

Huffman code
Short codes for common symbols and long ones for rare, built by merging the two lightest piles.
Code tree
The tree the merges build: the path from the top down to a letter spells its code.

Step 1 of 4

“label roll” lies on the table, a pile per letter. A gives common letters short codes.

Predict which letter gets the shortest code.

Which letter of “label roll” will get the shortest code?