Skip to content

UGC NET CS 2018Data Structures and Algorithms › Design TechniquesVerified

UGC NET CS 2018 PYQ: 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…

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 will have the average length of

  1. A
    2.4
  2. B
    1.87
  3. C
    3.0
  4. D
    2.15
    Correct answer

Answer

(D) 2.15

Approach

Build the Huffman tree from the given probabilities and compute the weighted external path length (average code length).

Reviewed by UGC IQ Editorial Team.