What should be the Huffman code of the following characters, if the characters…
2022
What should be the Huffman code of the following characters, if the characters and their frequencies are given as follows?
a:16, b:5, c:12, d:17, e:10, f:25
[Assuming that in Huffman tree, the label of the edge to the left child is 0 and that of the edge to the right child is 1.]
- A.
a:11, b:1010, c:111, d:01, e:1111, f:00
- B.
a:11, b:1010, c:111, d:01, e:1100, f:01
- C.
a:00, b:1110, c:110, d:01, e:1111, f:10
- D.
a:11, b:1010, c:001, d:10, e:0011, f:01
Attempted by 37 students.
Show answer & explanation
Correct answer: C
Combine the two smallest frequencies each time: b(5)+e(10)=15; c(12)+15=27; a(16)+d(17)=33; f(25)+27=52; finally 33+52=85. With left edge 0 and right edge 1, the codes are a=00, d=01, f=10, c=110, b=1110, e=1111. Therefore, option C is correct.