Mental Model
Huffman encoding builds a tree to assign shorter codes to frequent letters and longer codes to rare ones, saving space.
Analogy: Imagine packing a suitcase: you put small, frequent items in easy-to-reach spots and big, rare items in harder spots to save space efficiently.
Characters with frequencies: a:5 b:9 c:12 d:13 e:16 f:45 Initial nodes: [a:5] [b:9] [c:12] [d:13] [e:16] [f:45]
