# Hamming Distance

# What is Hamming Distance?

## Hamming Distance

Hamming distance is a measurement for contrasting two parallel data strings. While contrasting two parallel strings of equivalent length, Hamming distance is the quantity of spot positions in which the two pieces are unique.

The Hamming distance between two strings, an and b is signified as d(a,b).

It is utilized for mistake recognition or blunder revision when data is sent over PC organizations. It is likewise utilizing in coding hypothesis for looking at equivalent length data words.

## Calculation of Hamming Distance

To ascertain the Hamming distance between two strings, and , we play out their XOR activity, (a⊕ b), and afterward tally the absolute number of 1s in the resultant string.

### Example

Suppose there are two strings 1101 1001 and 1001 1101.

11011001 ⊕ 10011101 = 01000100. Since, this contains two 1s, the Hamming distance, d(11011001, 10011101) = 2.

## Minimum Hamming Distance

In a bunch of strings of equivalent lengths, the base Hamming distance is the littlest Hamming distance between all potential sets of strings in that set.

### Example

Suppose there are four strings 010, 011, 101 and 111.

010 ⊕ 011 = 001, d(010, 011) = 1.

010 ⊕ 101 = 111, d(010, 101) = 3.

010 ⊕ 111 = 101, d(010, 111) = 2.

011 ⊕ 101 = 110, d(011, 101) = 2.

011 ⊕ 111 = 100, d(011, 111) = 1.

101 ⊕ 111 = 010, d(011, 111) = 1.

Hence, the Minimum Hamming Distance, *d _{min}* = 1.