A text is made up of the characters A, B, C, D, E each occurring with the…
2018
A text is made up of the characters A, B, C, D, E each occurring with the probability 0.08, 0.40, 0.25, 0.15 and 0.12 respectively. The optimal coding technique will have the average length of :
- A.
2.4
- B.
1.87
- C.
3.0
- D.
2.15
Attempted by 149 students.
Show answer & explanation
Correct answer: D
Solution: Construct the optimal (Huffman) code to find the minimal average length.
Probabilities: A = 0.08, B = 0.40, C = 0.25, D = 0.15, E = 0.12.
Step 1: Combine the two smallest probabilities: 0.08 + 0.12 = 0.20 (pair A and E).
Step 2: New list: 0.20, 0.15, 0.25, 0.40. Combine the two smallest: 0.15 + 0.20 = 0.35 (D with previous pair).
Step 3: New list: 0.25, 0.35, 0.40. Combine 0.25 + 0.35 = 0.60.
Step 4: Combine 0.60 + 0.40 = 1.00 to complete the tree.
From this Huffman tree the codeword lengths (depths) are:
B (0.40): length 1
C (0.25): length 2
D (0.15): length 3
A (0.08) and E (0.12): length 4
Compute the average length L:
L = 0.40*1 + 0.25*2 + 0.15*3 + 0.12*4 + 0.08*4 = 0.40 + 0.50 + 0.45 + 0.48 + 0.32 = 2.15 bits per symbol.
Note: The source entropy is approximately 2.098 bits, so the Huffman average length (2.15) is close to and slightly above the entropy, as expected for an optimal prefix code.
Final answer: 2.15 bits per symbol.
A video solution is available for this question — log in and enroll to watch it.