Papers
Topics
Authors
Recent
Search
2000 character limit reached

Approximating Text-to-Pattern Hamming Distances

Published 1 Jan 2020 in cs.DS | (2001.00211v1)

Abstract: 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 σ\sigma, compute the Hamming distance between the pattern and the text at every location. Several (1+ϵ)(1+\epsilon)-approximation algorithms have been proposed in the literature, with running time of the form O(ϵ<sup>−O(1)nlog⁡</sup>nlog⁡m)O(\epsilon<sup>{-O(1)}n\log</sup> n\log m), all using fast Fourier transform (FFT). We describe a simple (1+ϵ)(1+\epsilon)-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(ϵ<sup>−2n)O(\epsilon<sup>{-2}n). - 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≤mk\le\sqrt m. - We obtain approximation algorithms with better ϵ\epsilon-dependence using rectangular matrix multiplication. The time-bound is  O(n)~O(n) when the pattern is sufficiently long: m≥ϵ<sup>−28m\ge \epsilon<sup>{-28}. Previous algorithms require  O(ϵ<sup>−1n)~O(\epsilon<sup>{-1}n) 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/k<sup>Ω(1)+occ)n<sup>o(1))O((n/k<sup>{\Omega(1)}+occ)n<sup>{o(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\delta m at every location, running in  O(δ<sup>−1/3n<sup>2/3+δ<sup>−1n/m)~O(\delta<sup>{-1/3}n<sup>{2/3}+\delta<sup>{-1}n/m) time. - We obtain a streaming algorithm to report all locations with Hamming distance approximately less than k, using  O(ϵ<sup>−2</sup>k)~O(\epsilon<sup>{-2}\sqrt</sup> k) space. Previously, streaming algorithms were known for the exact problem with ~O(k) space or for the approximate problem with  O(ϵ<sup>−O(1)</sup>m)~O(\epsilon<sup>{-O(1)}\sqrt</sup> m) space.

Citations (20)

Summary

No one has generated a summary of this paper yet.

Paper to Video (Beta)

No one has generated a video about this paper yet.

Whiteboard

No one has generated a whiteboard explanation for this paper yet.

Open Problems

We haven't generated a list of open problems mentioned in this paper yet.

Continue Learning

We haven't generated follow-up questions for this paper yet.