考虑如下给出的仅包含四个有效码字的二进制代码。 00000, 01011, 10101, 11110
设码的最小汉明距离为p,码可纠正的最大错误位数为q。 p 和 q 的值是:
(A) p = 3 且 q = 1
(B) p = 3 且 q = 2
(C) p = 4 且 q = 1
(D) p = 4 且 q = 2答案:(一)
说明:我们需要找到最小汉明距离(它们对应的位位置的差异)
00000, 01011, 10101, 11110
For two binary strings, hamming distance is number
of ones in XOR of the two strings.
Hamming distance of first and second is 3, so is
for first and third. Hamming distance of first and
fourth is 4.
Hamming distance of second and third is 4, and
second and fourth is 3.
Hamming distance of third and fourth is 3.
Thus a code with minimum Hamming distance d
between its codewords can detect at most d-1
errors and can correct ⌊(d-1)/2⌋ errors.
Here d = 3. So number of errors that can be
corrected is 1.
这个问题的测验