Hamming Distance Formula:
From: | To: |
The Hamming distance between two equal-length strings is the number of positions at which the corresponding symbols are different. For binary strings, it's simply the count of bit positions where the bits differ.
The calculator uses the Hamming distance formula:
Where:
Explanation: The calculator compares each corresponding bit position and counts how many positions differ.
Details: Hamming distance is widely used in error detection and correction codes, telecommunications, and bioinformatics for comparing genetic sequences.
Tips: Enter two binary strings of equal length containing only 0s and 1s. The calculator will count the number of differing bit positions.
Q1: What's the maximum possible Hamming distance?
A: For two n-bit strings, the maximum Hamming distance is n (all bits differ).
Q2: Can I use this for non-binary strings?
A: This calculator is for binary strings only, but Hamming distance can be calculated for any strings of equal length.
Q3: What's the Hamming distance between "000" and "111"?
A: 3, since all three bits are different.
Q4: How is Hamming distance used in error correction?
A: Error-correcting codes use minimum Hamming distance to determine how many errors can be detected and corrected.
Q5: What's the time complexity of Hamming distance calculation?
A: O(n) where n is the length of the strings, since each bit must be compared.