考虑一个仅包含四个有效代码字的二进制代码,如下所示。 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答案: (A)
说明:我们需要找到最小汉明距离(它们对应的位位置之间的差异)
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.
这个问题的测验