- 2079 Bhadra (CS II) · 5 marks
Huffman code for seven-symbol source
Short answer
Huffman codes are S0=10, S1=11, S2=001, S3=010, S4=011, S5=0000, S6=0001. Average code length equals entropy at 2.625 bits/symbol, giving 100% efficiency since all probabilities are negative powers of two.
A discrete memoryless source has an alphabet of seven symbols whose probabilities occurrence are as under.
| Symbol | S0 | S1 | S2 | S3 | S4 | S5 | S6 |
|---|---|---|---|---|---|---|---|
| Probability | 0.25 | 0.25 | 0.125 | 0.125 | 0.125 | 0.0625 | 0.0625 |
Determine the Huffman code for above source.
Huffman procedure: arrange symbols in decreasing probability; combine the two lowest probabilities into one; place the sum in the list as high as possible; repeat until one probability (1.0) is left. Then trace back, giving 0 to the upper branch and 1 to the lower branch at each combination.
Reduction (sum of two lowest moved up as high as possible):
| Stage | Probabilities (descending) | Combined |
|---|---|---|
| 1 | 0.25, 0.25, 0.125, 0.125, 0.125, 0.0625, 0.0625 | 0.0625 + 0.0625 = 0.125 |
| 2 | 0.25, 0.25, 0.125, 0.125, 0.125, 0.125 | 0.125 + 0.125 = 0.25 |
| 3 | 0.25, 0.25, 0.25, 0.125, 0.125 | 0.125 + 0.125 = 0.25 |
| 4 | 0.25, 0.25, 0.25, 0.25 | 0.25 + 0.25 = 0.5 |
| 5 | 0.5, 0.25, 0.25 | 0.25 + 0.25 = 0.5 |
| 6 | 0.5, 0.5 | 0.5 + 0.5 = 1 |
| Symbol | Huffman code | ||
|---|---|---|---|
| S0 | 0.25 | 10 | 2 |
| S1 | 0.25 | 11 | 2 |
| S2 | 0.125 | 001 | 3 |
| S3 | 0.125 | 010 | 3 |
| S4 | 0.125 | 011 | 3 |
| S5 | 0.0625 | 0000 | 4 |
| S6 | 0.0625 | 0001 | 4 |
Entropy:
Average code length:
Efficiency:
The efficiency is 100 % because every probability is a negative power of 2 (), so each code length equals exactly. A fixed-length code would need 3 bits/symbol (efficiency ).
Answer: S0, S1 get 2-bit codes, S2, S3, S4 get 3-bit codes and S5, S6 get 4-bit codes (as in the table); bits/symbol, efficiency 100 %.
✓ Answer checked by Claude Opus 5.5 (high effort)
Related questions
- Source vs channel coding; Huffman for five symbols · Communication Systems, chapter 6
- Source coding; Huffman for five symbols (0.3, 0.25, 0.2, 0.15, 0.1) · Communication Systems, chapter 6
- Importance of source coding; Huffman for eight symbols at 1000 symbols/s · Communication Systems, chapter 6
- Importance of source coding; Shannon-Fano vs fixed length (seven symbols) · Communication Systems, chapter 6
- Huffman code for five-symbol DMS vs fixed length · Communication Systems, chapter 6
- Symbol rate, entropy and information rate (6 symbols per 10 μs) · Communication Systems, chapter 6
- Huffman code for six symbols (0.04, 0.1, ...) · Data Communication, chapter 8
- Huffman code for p = 0.5, 0.25, 0.125, 0.125 · Data Communication, chapter 8
- Shannon-Fano code for six symbols · Data Communication, chapter 8
- Huffman code for symbols A to E (0.4, 0.3, ...) · Data Communication, chapter 8