Approximating Text-to-Pattern Hamming Distances
Not on the map. Why?
Abstract (arXiv)
We revisit a fundamental problem in string matching: given a pattern of length m and a text of length n, both over an alphabet of size σ, compute the Hamming distance between the pattern and the text at every location. Several (1+ε)-approximation algorithms have been proposed in the literature, with running time of the form O(ε-O(1)nlog nlog m), all using fast Fourier transform (FFT). We describe a simple (1+ε)-approximation algorithm that is faster and does not need FFT. Combining our approach with additional ideas leads to numerous new results: - We obtain the first linear-time approximation algorithm; the running time is O(ε-2n). - We obtain a faster exact algorithm computing all Hamming distances up to a given threshold k; its running time improves previous results by logarithmic factors and is linear if k≤√ m. - We obtain approximation algorithms with better ε-dependence using rectangular matrix multiplication. The time-bound is ~O(n) when the pattern is sufficiently long: m≥ ε-28. Previous algorithms require ~O(ε-1n) time. - When k is not too small, we obtain a truly sublinear-time algorithm to find all locations with Hamming distance approximately (up to a constant factor) less than k, in O((n/kOmega(1)+occ)no(1)) time, where occ is the output size. The algorithm leads to a property tester, returning true if an exact match exists and false if the Hamming distance is more than δ m at every location, running in ~O(δ-1/3n2/3+δ-1n/m) time. - We obtain a streaming algorithm to report all locations with Hamming distance approximately less than k, using ~O(ε-2√ k) space. Previously, streaming algorithms were known for the exact problem with ~O(k) space or for the approximate problem with ~O(ε-O(1)√ m) space.
Key facts. Cited by 1 paper in the map (data through 14 Oct 2026). First posted on arXiv 1 Jan 2020.
Builds on
No reference list yet.
Built on by
Citing papers per year: 2026: 1.
1 paper.
- 2026Cross-Country Code-Mixing for Generative Recommendationcited by 0
- 2026Cross-Country Code-Mixing for Generative Recommendation24 Sep 2026