Lecture 08: Practice Problems

1. Equal Frequency Huffman

If all characters have equal frequency, what does the Huffman tree look like?

Show Answer

A Perfect (or Complete) Binary Tree.

The depth is log n for all leaves. Codes are fixed length, which is optimal when frequencies are equal.

2. Fibonacci Frequencies

What happens when character frequencies are Fibonacci numbers: 1, 1, 2, 3, 5, 8...?

Show Answer

A very unbalanced tree (comb shape).

Each merge produces the next Fibonacci number. Results in worst-case code lengths of up to n-1 bits.