Consider the characters and their frequency counts. Frequencies: a = 24 b = 16…
2017
Consider the characters and their frequency counts.

Frequencies:
a = 24b = 16c = 12d = 20e = 8f = 4
Using Huffman coding, which of the following is a valid code for character c?
- A.
11111
- B.
1110
- C.
11110
- D.
110
Attempted by 132 students.
Show answer & explanation
Correct answer: D
Concept: Huffman coding builds an optimal prefix-free code by a greedy bottom-up merge: repeatedly take the two nodes with the smallest weights, merge them into a parent whose weight is their sum, and repeat until one root remains. A leaf's code length equals its depth in this tree, so a more frequent symbol generally ends up nearer the root (shorter code) and a rarer symbol ends up deeper (longer code).
Application (build the tree for f=4, e=8, c=12, b=16, d=20, a=24):
Merge the two smallest,
f(4)ande(8), into(f,e)=12.Smallest weights now are
c(12)and(f,e)=12; merge them into(c,(f,e))=24. This placescone level aboveeandf.Merge
b(16)andd(20)into(b,d)=36.Merge
a(24)with the(c,(f,e))=24node into48.Merge the last two,
(b,d)=36and48, into the root84.
Tracing the path to c: root -> the weight-48 node -> the weight-24 node -> c. So c sits at depth 3, giving it a code of length 3; e and f sit at depth 4 (length-4 codes).
Cross-check: a consistent prefix-free assignment for the whole tree is a=10, b=00, d=01, c=110, f=1110, e=1111 (the e/f branches may swap with the opposite left/right convention, but c stays at depth 3). The depth-3 path for c yields the 3-bit code 110, which is the valid code for c among the given options.