Information Theory and Coding Basics
A source emits the symbols A, B, C and D independently with probabilities 0.4, 0.3, 0.2 and 0.1, and it is encoded with a Huffman code. Which of the following is the average code length per symbol?
- AAbout 1.85 bits
- B1.9 bits
- C2 bits
Show answer and explanation
Answer: B. 1.9 bits
A Huffman code repeatedly merges the two smallest probabilities. 0.1 and 0.2 are merged into 0.3, then 0.3 and 0.3 into 0.6, and finally 0.6 and 0.4, so the code lengths are 1 bit for A, 2 bits for B and 3 bits for C and D. The average code length is 0.4 × 1 + 0.3 × 2 + 0.2 × 3 + 0.1 × 3 = 1.9 bits.
- A. About 1.85 bits is the entropy of this source, the lower bound of the average code length. The probabilities are not reciprocals of powers of 2 such as 1/2 or 1/4, so even a Huffman code cannot get that short.
- B. Correct. 0.4 + 0.6 + 0.6 + 0.3 = 1.9 bits.
- C. 2 bits is the code length of a fixed-length code that represents the four symbols with equal lengths.
Continue: 9 more Information Theory and Coding Basics questions