Skip to content
Related Articles

Related Articles

Improve Article

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

Answer: (A)

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) = 2^n
Strings with hamming distance d = C(n,d)
Therefore probability = \frac{C(n,d)}{2^n}

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.

My Personal Notes arrow_drop_up
Recommended Articles
Page :