# Single-error correction · example 3

Subject: Computer Networks

Exam: TEE

Reader: https://deep-learning-study-room.vercel.app/cn/#tee/practice/error-control/hamming-code-3

Canonical: https://deep-learning-study-room.vercel.app/read/cn/tee/practice/error-control--hamming-code-3/

Optional extension · no matching calculation in the two supplied papers

**Optional worked extension.** This calculation format was not found in the supplied December 2025 final or February 2026 re-exam. The numbers and practice marks are authored. Study the core concept and actual-paper questions first; this is extra explanation, not a TEE prediction.

### Practice question. Encode data 1101 using even-parity Hamming coding. Number positions left-to-right starting at 1 and insert data in that order. If bit position 7 flips, show how the receiver locates and corrects it. [7 practice marks]

#### Answer

## Given

Data=1101; even parity; error position=7; only one bit flips.

## To find

Redundant bits, complete codeword and syndrome correction.

## Formula and why



$$
2^r\ge m+r+1
$$





$$
\mathrm{syndrome}=s_1+2s_2+4s_4+\cdots
$$



Parity positions correspond to binary index bits, so a single flipped position changes precisely its index checks.

## Step-by-step solution

#### Step 1. Choose redundancy

m=4; r=3: 23=8 ≥ 4+3+1=8; one fewer parity bit fails.

#### Step 2. Place data and compute checks

| Check | Covered positions (including check) | Parity bit |
| --- | --- | --- |
| p1 | 1, 3, 5, 7 | 1 |
| p2 | 2, 3, 6, 7 | 0 |
| p4 | 4, 5, 6, 7 | 0 |

| Position | 1 | 2 | 3 | 4 | 5 | 6 | 7 |
| --- | --- | --- | --- | --- | --- | --- | --- |
| Encoded bit | 1 | 0 | 1 | 0 | 1 | 0 | 1 |

#### Step 3. Introduce and check the error

Received = 1010100

| Syndrome check | Received-bit XOR | Result |
| --- | --- | --- |
| s1 | 1 XOR 1 XOR 1 XOR 0 | 1 |
| s2 | 0 XOR 1 XOR 0 XOR 0 | 1 |
| s4 | 0 XOR 1 XOR 0 XOR 0 | 1 |

#### Step 4. Locate and flip

Syndrome integer=7. Flip position 7; recovered codeword=1010101; extracted data=1101.

**Final answer:** Codeword 1010101; syndrome 7; corrected data 1101.

#### What this result means

The position direction is explicit. A solution using right-to-left numbering can look different while being consistent; never mix conventions.
