The characters a to h have the set of frequencies based on the first 8…

2006

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. A.

    fdheg

  2. B.

    ecgdf

  3. C.

    dchfg

  4. D.

    fehdg

Attempted by 71 students.

Show answer & explanation

Correct answer: A

Solution summary: decode the bit string using the Huffman codes formed from the given frequencies.

Step 1 — Build Huffman codes:

  • h: 0

  • g: 10

  • f: 110

  • e: 1110

  • d: 11110

  • c: 111110

  • a: 1111110

  • b: 1111111

Step 2 — Decode the bit string 110111100111010 by matching prefixes (left to right):

  1. 110 → f

  2. 11110 → d

  3. 0 → h

  4. 1110 → e

  5. 10 → g

Final decoded sequence: fdheg

A video solution is available for this question — log in and enroll to watch it.

Explore the full course: Gate Guidance By Sanchit Sir