GATE | GATE-CS-2004 | Question 78
Two n bit binary strings, S1 and S2, are chosen randomly with uniform probability. The probability that the Hamming distance between these strings (the number of bit positions where the two strings differ) is equal to d is
(A) nCd /2n
(B) nCd / d
Explanation: The hamming distance of strings S1 and S2 can be any value between 0 and n.
Hamming distance is the number of different bits between two strings. For a given string and d distance, there can be C(n,d) strings having d as the hamming distance as from n bits any d need to be chosen.
For any string S1, there are –
C(n,0) strings with 0 hamming distance
C(n,1) strings with 1 hamming distance
C(n,2) strings with 2 hamming distance
C(n,n) strings with n hamming distance
Total strings = C(n,0) + C(n,1) + … + C(n,n) =
Strings with hamming distance d = C(n,d)
Therefore probability =
Quiz of this Question
Attention reader! Don’t stop learning now. Practice GATE exam well before the actual exam with the subject-wise and overall quizzes available in GATE Test Series Course.
Learn all GATE CS concepts with Free Live Classes on our youtube channel.