GATE CSE 2017 Session 2 Q60: Expected Huffman-encoded length of a 100-character message
- Algorithms
- 2 marks
- NAT
- No negative marking
Syllabus topic: Algorithm design techniques: greedy, dynamic programming and divide-and-conquer
Question
A message is made up entirely of characters from the set . The table of probabilities for each of the characters is shown below:
| Character | Probability |
|---|---|
| 0.22 | |
| 0.34 | |
| 0.17 | |
| 0.19 | |
| 0.08 | |
| Total | 1.00 |
If a message of 100 characters over is encoded using Huffman coding, then the expected length of the encoded message in bits is ________.
Try it: numerical answer: type the value
Show answer and explanation
Answer: 225 (official GATE 2017 final answer key)
Concept used: Huffman coding repeatedly merges the two least probable symbols; expected length is per character, times the message length.
First step: Build the Huffman tree by merging and first, find each character's code length, and compute the average bits per character.
Full step-by-step solution
Loading…
Answer from the official final answer key. Found a mistake? Use Report issue and we will fix it.
More questions on Algorithm design techniques: greedy, dynamic programming and divide-and-conquer
Every PYQ on this topic →Share this question
Source: official GATE 2017 Session 2 CS question paper and final answer key, organised by IIT Roorkee. Question paper · Answer key
More Algorithms PYQs
- 2026 Session 1 · Q17Solve nested recurrences T1 = 4T1(n/2) + T2, T2 = 5T2(n/4) + log n
- 2026 Session 1 · Q41Shortest paths with at most k edges: two statements
- 2026 Session 1 · Q47Condition forcing a vertex into every minimum vertex cover
- 2026 Session 1 · Q49Cycle and cut properties of MSTs with distinct weights
- 2026 Session 1 · Q50Impossible DFS discovery/finish orderings for a DAG edge
- 2026 Session 1 · Q55Properties of 2-colorable (bipartite) graphs