Answer : 6
Definition: The number of bits which differ between two binary strings. More formally, the distance between two strings A and B is ∑ | Ai - Bi |.
Steps to calculate Hamming Distance
Step 1 :Ensure the two strings are of equal length. The Hamming distance can only be calculated between two strings of equal length. String 1: "1001 0100 0110" String 2: "1101 1110 1101"
Step 2 :Compare the first two bits in each string. If they are the same, record a "0" for that bit. If they are different, record a "1" for that bit. In this case, the first bit of both strings is "1," so record a "0" for the first bit.
Step 3 :Compare each bit in succession and record either "1" or "0" as appropriate.String 1: "1001 0100 0110" String 2: "1101 1110 1101" Record: "0100 1010 1011"
Step 4 :Add all the ones and zeros in the record together to obtain the Hamming distance. Hamming distance = 0 + 1 + 0 + 0 + 1 + 0 + 1 + 0 + 1 + 0 + 1 + 1 = 6
If using a computer, "XOR" can be used to compare the two strings and obtain the "record."