javascript-algorithms/src/algorithms/string/hamming-distance
Oleksii Trekhleb 66ebd7859a Add Hamming.
2018-04-24 14:45:55 +03:00
..
__test__ Add Hamming. 2018-04-24 14:45:55 +03:00
hammingDistance.js Add Hamming. 2018-04-24 14:45:55 +03:00
README.md Add Hamming. 2018-04-24 14:45:55 +03:00

Hamming Distance

the Hamming distance between two strings 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 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.

Examples

The Hamming distance between:

  • "karolin" and "kathrin" is 3.
  • "karolin" and "kerstin" is 3.
  • 1011101 and 1001001 is 2.
  • 2173896 and 2233796 is 3.

References

Wikipedia