Overview
Hamming Distance is a simple fixed-position difference measure for equal-length sequences.
Counts positions where two equal-length strings or vectors differ.
Compact metadata for implementation and discovery.
Hamming Distance is a simple fixed-position difference measure for equal-length sequences.
Quick facts
Runtime and memory behavior at a glance.
Best
O(n)
Average
O(n)
Worst
O(n)
Space
O(1)
distance = count(i where a[i] != b[i])Counts aligned positions with different symbols.
Show two aligned strings with mismatched positions highlighted.
For unequal-length sequences, edit distance is usually a better fit.
What each reference supports for this entry.
String algorithms reference covering Hamming Distance recurrences, automata/indexing structures, or exact/approximate matching role.
Good next jumps from the relationship graph, ranked for useful discovery.
Both score string similarity with different assumptions.
Hamming distance compares substitutions only for equal-length strings.