Mental Model
Huffman Encoding builds a tree to assign shorter codes to frequent letters and longer codes to rare letters, saving space.
Analogy: Imagine packing a suitcase where you put small, often-used items in easy-to-reach spots and big, rarely-used items deeper inside to save space.
Frequency Table:
A:5 B:9 C:12 D:13 E:16 F:45
Huffman Tree (partial):
[100]
/ \
[45:F] [55]
/ \
[25] [30]
/ \ / \
[12:C][13:D][14] [16:E]
/ \
[5:A][9:B]