C1 | C2 | D1 | C3 | D2 | D3 | D4 | C4 |
0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
1 | 1 | 0 | 1 | 0 | 0 | 1 | 0 |
0 | 1 | 0 | 1 | 0 | 1 | 0 | 1 |
1 | 0 | 0 | 0 | 0 | 1 | 1 | 1 |
1 | 0 | 0 | 1 | 1 | 0 | 0 | 1 |
0 | 1 | 0 | 0 | 1 | 0 | 1 | 1 |
1 | 1 | 0 | 0 | 1 | 1 | 0 | 0 |
0 | 0 | 0 | 1 | 1 | 1 | 1 | 0 |
1 | 1 | 1 | 0 | 0 | 0 | 0 | 1 |
0 | 0 | 1 | 1 | 0 | 0 | 1 | 1 |
1 | 0 | 1 | 1 | 0 | 1 | 0 | 0 |
0 | 1 | 1 | 0 | 0 | 1 | 1 | 0 |
0 | 1 | 1 | 1 | 1 | 0 | 0 | 0 |
1 | 0 | 1 | 0 | 1 | 0 | 1 | 0 |
0 | 0 | 1 | 0 | 1 | 1 | 0 | 1 |
1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 |
This code is designed for four transmitted data bits: D1, D2, D3, D4
Four check bits (C1, C2, C3, C4) are added for error correction and detection. The check bits are computed as follows:
C1, C2, and C3 are each computed from different subsets of the data bits, while C4 is computed as the parity of all other check bits and data bits.
Note that the set of codes in the table has Hamming distance 4; you may select any pair of two different codes, and the Hamming distance between that pair will be at least 4; they will differ in at least 4 bit positions.
A Hamming distance of 4 is sufficient for single error correction and double error detection (at the same time).
If a received code exactly matches one of the codes in the table, no errors have occurred. If a received code differs from one of the codes in the table by one bit (Hamming distance 1), then a single bit error is assumed to have occurred, and it can be corrected. If a received code differs from one of the codes in the table by two bits (Hamming distance 2), then a double bit error is assumed to have occurred. This can be reported, but it can't necessarily be corrected, since the received code may differ in exactly two bits from several of the codes in the table.
Using the Hamming code above, what should the receiver do if it receives each of these codes?
1.
Received code:
1 1 1 0 0 0 0 1
Solution here
2.
Received code:
0 1 0 1 1 1 0 1
Solution here
3.
Received code:
0 1 1 1 0 1 1 0
Solution here
4.
Received code:
0 1 1 1 1 1 0 1
Solution here
5.
Below is a set of three 11 bit codes, labeled (a), (b), (c)
(a) 0 0 0 0 1 1 1 1 0 0 0
(b) 0 0 1 1 0 0 1 1 0 0 1
(c) 0 1 0 1 0 1 0 1 0 1 0
What is the Hamming distance for this set? Why?
Solution here