Questions: Huffman Coding

4 questions to test your understanding

Score: 0 / 4
Question 1 Multiple Choice

A source has four symbols with probabilities {0.5, 0.25, 0.125, 0.125}. What is the Huffman code, and what is its average length?

AAll symbols get 2-bit codes; average length = 2 bits
BCodewords: 0, 10, 110, 111; average length = 1*0.5 + 2*0.25 + 3*0.125 + 3*0.125 = 1.75 bits
CCodewords: 00, 01, 10, 11; average length = 2 bits
DCodewords: 0, 1, 00, 01; average length = 1.25 bits
Question 2 True / False

Huffman codes are guaranteed to achieve the exact entropy rate H(X) for any source distribution.

TTrue
FFalse
Question 3 Short Answer

Why must a practical compression code be prefix-free (no codeword is a prefix of another), and how does Huffman coding guarantee this property?

Think about your answer, then reveal below.
Question 4 Short Answer

A colleague proposes using Huffman coding on individual bytes of a file for compression. Why might this perform poorly compared to more sophisticated methods?

Think about your answer, then reveal below.