Hamming distance
| 
 | |||
| Class | String similarity | ||
|---|---|---|---|
| Data structure | string | ||
| Worst-case performance | |||
| Best-case performance | |||
| Average performance | |||
| Worst-case space complexity | |||
3-bit binary cube for finding Hamming distance
The minimum distance between any two vertices is the Hamming distance between the two binary strings.
In information theory, the Hamming distance between two strings or vectors of equal length is the number of positions at which the corresponding symbols are different. In other words, it measures the minimum number of substitutions required to change one string into the other, or equivalently, the minimum number of errors that could have transformed one string into the other. In a more general context, the Hamming distance is one of several string metrics for measuring the edit distance between two sequences. It is named after the American mathematician Richard Hamming.
A major application is in coding theory, more specifically to block codes, in which the equal-length strings are vectors over a finite field.