---
title: "Source coding; Huffman for five symbols (0.3, 0.25, 0.2, 0.15, 0.1)"
subject: "Communication Systems"
chapter: 6
key: "semester_6/communication_systems:source-coding-huffman-five-s0"
source: https://www.bctengineer.com/q/semester_6/communication_systems/source-coding-huffman-five-s0
site: BCT Engineering
---

# Source coding; Huffman for five symbols (0.3, 0.25, 0.2, 0.15, 0.1)

Communication Systems · Chapter 6: Baseband Digital Data Transmission

- Asked in: 2070 Asar (CS II), 1+3+1 marks
- Video: [Huffman Coding Example | PYQ 2024-25 ADC BEE058 | Huffman code | entropy | Efficiency calculation](https://www.youtube.com/watch?v=-fHJxmC9ABM) — Techno Tutorials ( e-Learning)
- Answer checked by Claude Opus 5.5 (high effort) on 2026-10-14
- Page: https://www.bctengineer.com/q/semester_6/communication_systems/source-coding-huffman-five-s0
- Whole chapter: https://www.bctengineer.com/md/semester_6/communication_systems/chapter-6

## Question

What is source coding? Develop Huffman coding of a 5 symbol source with probabilities: S0 = 0.3, S1 = 0.25, S2 = 0.2, S3 = 0.15, S4 = 0.1. And also calculate Coding efficiency.

## Short answer

Source coding represents symbols with minimal average bits. Huffman coding assigns S0=00, S1=10, S2=11, S3=010, S4=011, giving average length 2.25 bits and efficiency 99.03%.

## Answer

#### Source coding

**Source coding** is the process of representing the symbols of an information source by binary code words with the least average number of bits, by removing redundancy, so that the average code length approaches the source entropy (e.g. Huffman, Shannon–Fano coding).

#### Huffman code

$P$: S0 = 0.3, S1 = 0.25, S2 = 0.2, S3 = 0.15, S4 = 0.1.

**Reduction (sum of two lowest moved up as high as possible):**

| Stage | Probabilities (descending) | Combined |
|---|---|---|
| 1 | 0.3, 0.25, 0.2, 0.15, 0.1 | 0.15 + 0.1 = 0.25 |
| 2 | 0.3, 0.25, 0.25, 0.2 | 0.25 + 0.2 = 0.45 |
| 3 | 0.45, 0.3, 0.25 | 0.3 + 0.25 = 0.55 |
| 4 | 0.55, 0.45 | 0.55 + 0.45 = 1 |

| Symbol | $p_i$ | Huffman code | $l_i$ |
|---|---|---|---|
| S0 | 0.3 | 00 | 2 |
| S1 | 0.25 | 10 | 2 |
| S2 | 0.2 | 11 | 2 |
| S3 | 0.15 | 010 | 3 |
| S4 | 0.1 | 011 | 3 |

#### Coding efficiency

| Symbol | $p_i$ | $\log_2(1/p_i)$ | $p_i\log_2(1/p_i)$ |
|---|---|---|---|
| S0 | 0.3 | 1.7370 | 0.5211 |
| S1 | 0.25 | 2.0000 | 0.5000 |
| S2 | 0.2 | 2.3219 | 0.4644 |
| S3 | 0.15 | 2.7370 | 0.4105 |
| S4 | 0.1 | 3.3219 | 0.3322 |
| **Total** | 1 | | **2.2282** |

$$
\begin{aligned}
H &= 2.2282\ \text{bits/symbol} \\
\bar L &= 0.3(2)+0.25(2)+0.2(2)+0.15(3)+0.1(3) = 2.25\ \text{bits/symbol} \\
\eta &= \frac{H}{\bar L} = \frac{2.2282}{2.25} = 99.03\%
\end{aligned}
$$

**Answer:** S0, S1, S2 get 2-bit codes and S3, S4 get 3-bit codes; efficiency **99.03 %**.

## Check yourself

The answer's key points as multiple-choice questions, with the correct option and why.

1. What is source coding?
   A. Adding redundancy against noise
   B. Representing source symbols by binary words with least average bits by removing redundancy
   C. Converting bits to waveforms
   D. Encrypting the message
   Answer: B. Its aim is to bring average code length close to the entropy. (Key point: Definition of source coding)

2. For P = {0.3, 0.25, 0.2, 0.15, 0.1}, what is the first merge?
   A. 0.3 + 0.25
   B. 0.15 + 0.1 = 0.25
   C. 0.2 + 0.15
   D. 0.25 + 0.2
   Answer: B. The two smallest probabilities, 0.15 and 0.1, are merged. (Key point: First Huffman merge)

3. With L = 2.25 and H = 2.2282, what is the efficiency?
   A. 99.03%
   B. 95%
   C. 100%
   D. 74.27%
   Answer: A. 2.2282/2.25 = 99.03%. (Key point: Efficiency)

## Related in Communication Systems

- [Source vs channel coding; Huffman for five symbols](https://www.bctengineer.com/question.md?key=semester_6%2Fcommunication_systems%3Asource-channel-huffman-five) — Communication Systems, chapter 6
- [Huffman code for seven-symbol source](https://www.bctengineer.com/question.md?key=semester_6%2Fcommunication_systems%3Ahuffman-seven-symbols) — Communication Systems, chapter 6
- [Importance of source coding; Huffman for eight symbols at 1000 symbols/s](https://www.bctengineer.com/question.md?key=semester_6%2Fcommunication_systems%3Asource-coding-huffman-eight-1000) — Communication Systems, chapter 6
- [Importance of source coding; fixed vs Shannon-Fano (five symbols)](https://www.bctengineer.com/question.md?key=semester_6%2Fcommunication_systems%3Asource-coding-fixed-sf-five) — Communication Systems, chapter 6
- [Huffman code for five-symbol DMS vs fixed length](https://www.bctengineer.com/question.md?key=semester_6%2Fcommunication_systems%3Ahuffman-dms-five-symbols) — Communication Systems, chapter 6
- [Importance of source coding; Shannon-Fano vs fixed length (seven symbols)](https://www.bctengineer.com/question.md?key=semester_6%2Fcommunication_systems%3Asource-coding-sf-fixed-seven) — Communication Systems, chapter 6

## Related in other subjects

- [Huffman code for five symbols (0.2, 0.35, ...)](https://www.bctengineer.com/question.md?key=semester_5%2Fdata_communication%3Ahuffman-five-symbols-02-035) — Data Communication, chapter 8
- [Huffman code for six symbols (0.04, 0.1, ...)](https://www.bctengineer.com/question.md?key=semester_5%2Fdata_communication%3Ahuffman-six-symbols-004) — Data Communication, chapter 8
- [Huffman code for symbols A to E (0.4, 0.3, ...)](https://www.bctengineer.com/question.md?key=semester_5%2Fdata_communication%3Ahuffman-table-abcde) — Data Communication, chapter 8
- [Laplace: current with S1 closing and S2 opening at 4 ms](https://www.bctengineer.com/question.md?key=semester_3%2Felectrical_circuit_theory%3Alaplace-two-switch-s1-s2-4ms) — Electrical Circuit Theory, chapter 4
