• retagged by
19,919 views
40 40 votes

The characters $a$ to $h$ have the set of frequencies based on the first $8$ Fibonacci numbers as follows

$a : 1$, $b : 1$, $c : 2$, $d : 3$, $e : 5$, $f : 8$, $g : 13$, $h : 21$

A Huffman code is used to represent the characters. What is the sequence of characters corresponding to the following code?

$110111100111010$

  1. $fdheg$
  2. $ecgdf$
  3. $dchfg$
  4. $fehdg$

2 Answers

Best answer
61 61 votes

Answer is A. Huffman's tree is as follows. The two least frequent characters are taken as the children of a newly made node and the frequency of the newly made node is made equal to the sum of those two child nodes. Then the same procedure is repeated till all nodes are finished. 

$110111100111010 = 110\;11110\;0\;1110\;10 = fdheg$

• edited by
12 12 votes

we apply greedy algorithm on the frequencies of the characters to generate the binary tree.Assigning 0 to the left edge and 1 to the right edge.

prefix codes for the characters are...

a – 1111110
b – 1111111
c – 111110
d – 11110
e – 1110
f – 110
g – 10
h – 0

Given String can be decomposed as fdheg.

Answer is A.

Answer:
Position:
Show:

Related questions

49 49 votes
3 answers 3 answers
23.4k
23.4k views
go_editor asked Apr 23, 2016
23,394 views
Suppose the letters $a, \,b, \,c, \,d, \,e, \,f$ have probabilities $\dfrac{1}{2}, \dfrac{1}{4}, \dfrac{1}{8}, \dfrac{1}{16}, \dfrac{1}{32}, \dfrac{1}{32}$, respectively....
43 43 votes
4 answers 4 answers
16.4k
16.4k views
Kathleen asked Sep 21, 2014
16,393 views
Suppose the letters $a, \,b, \,c, \,d, \,e, \,f$ have probabilities $\frac{1}{2}, \frac{1}{4}, \frac{1}{8}, \frac{1}{16}, \frac{1}{32}, \frac{1}{32}$, respectively. Which...