UGC-NET Jun 2015 · Asymptotic Analysis & Recurrences

MCQ · 2 marks · Problem PROG-DIVC-0037

Given the symbols A, B, C, D, E, F, G and H with the probabilities$\frac{1}{30}, \frac{1}{30}, \frac{1}{30}, \frac{2}{30}, \frac{3}{30}, \frac{5}{30}, \frac{5}{30}$ and $\frac{12}{30}$respectively. The average Huffman code size in bits per symbol is
  1. A
    $\frac{67}{30}$
  2. B
    $\frac{70}{34}$
  3. C
    $\frac{76}{30}$
  4. D
    $\frac{78}{30}$

Solve it on GATE DA practice →More Searching & Sorting Algorithms problems

Show the worked solution\[\boxed{\text{average length}=\frac{\text{sum of all merged weights}}{\text{total weight}}}\]Work with weights \(1,1,1,2,3,5,5,12\) (out of 30) and always merge the two smallest:\[1+1=2,\ 1+2=3,\ 2+3=5,\ 3+5=8,\ 5+5=10,\ 8+10=18,\ 12+18=30.\]Each merge adds one bit to every symbol below it, so the total weighted length is the sum of the merged weights:\[2+3+5+8+10+18+30=76.\]\[\text{average}=\frac{76}{30}\ \text{bits per symbol}.\]Answer: C

GATE DA practice: past exam problems by chapter, with worked solutions · gatedaprep.com