Related Articles
GATE | GATE-CS-2004 | Question 78
• Difficulty Level : Medium
• Last Updated : 13 Nov, 2017

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
(C) d/2n
(D) 1/2d

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

My Personal Notes arrow_drop_up