mirror of
https://github.com/trekhleb/javascript-algorithms.git
synced 2026-03-13 08:51:02 +08:00
Add Hamming.
This commit is contained in:
23
src/algorithms/string/hamming-distance/README.md
Normal file
23
src/algorithms/string/hamming-distance/README.md
Normal file
@@ -0,0 +1,23 @@
|
||||
# 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:
|
||||
|
||||
- "ka**rol**in" and "ka**thr**in" is **3**.
|
||||
- "k**a**r**ol**in" and "k**e**r**st**in" is **3**.
|
||||
- 10**1**1**1**01 and 10**0**1**0**01 is **2**.
|
||||
- 2**17**3**8**96 and 2**23**3**7**96 is **3**.
|
||||
|
||||
## References
|
||||
|
||||
[Wikipedia](https://en.wikipedia.org/wiki/Hamming_distance)
|
||||
Reference in New Issue
Block a user