English

Approximate Online Pattern Matching in Sub-linear Time

Data Structures and Algorithms 2018-11-06 v2

Abstract

We consider the approximate pattern matching problem under edit distance. In this problem we are given a pattern PP of length ww and a text TT of length nn over some alphabet Σ\Sigma, and a positive integer kk. The goal is to find all the positions jj in TT such that there is a substring of TT ending at jj which has edit distance at most kk from the pattern PP. Recall, the edit distance between two strings is the minimum number of character insertions, deletions, and substitutions required to transform one string into the other. For a position tt in {1,...,n}\{1,...,n\}, let ktk_t be the smallest edit distance between PP and any substring of TT ending at tt. In this paper we give a constant factor approximation to the sequence k1,k2,...,knk_1,k_2,...,k_{n}. We consider both offline and online settings. In the offline setting, where both PP and TT are available, we present an algorithm that for all tt in {1,...,n}\{1,...,n\}, computes the value of ktk_t approximately within a constant factor. The worst case running time of our algorithm is O(nw3/4)O(n w^{3/4}). As a consequence we break the O(nw)O(nw)-time barrier for this problem. In the online setting, we are given PP and then TT arrives one symbol at a time. We design an algorithm that upon arrival of the tt-th symbol of TT computes ktk_t approximately within O(1)O(1)-multiplicative factor and w8/9w^{8/9}-additive error. Our algorithm takes O(w1(7/54))O(w^{1-(7/54)}) amortized time per symbol arrival and takes O(w1(1/54))O(w^{1-(1/54)}) additional space apart from storing the pattern PP. Both of our algorithms are randomized and produce correct answer with high probability. To the best of our knowledge this is the first worst-case sub-linear (in the length of the pattern) time and sub-linear succinct space algorithm for online approximate pattern matching problem.

Keywords

Cite

@article{arxiv.1810.03551,
  title  = {Approximate Online Pattern Matching in Sub-linear Time},
  author = {Diptarka Chakraborty and Debarati Das and Michal Koucky},
  journal= {arXiv preprint arXiv:1810.03551},
  year   = {2018}
}
R2 v1 2026-06-23T04:32:21.646Z