English

On pattern matching with k mismatches and few don't cares

Data Structures and Algorithms 2016-10-31 v2

Abstract

We consider the problem of pattern matching with kk mismatches, where there can be don't care or wild card characters in the pattern. Specifically, given a pattern PP of length mm and a text TT of length nn, we want to find all occurrences of PP in TT that have no more than kk mismatches. The pattern can have don't care characters, which match any character. Without don't cares, the best known algorithm for pattern matching with kk mismatches has a runtime of O(nklogk)O(n\sqrt{k \log k}). With don't cares in the pattern, the best deterministic algorithm has a runtime of O(nkpolylogm)O(nk polylog m). Therefore, there is an important gap between the versions with and without don't cares. In this paper we give an algorithm whose runtime increases with the number of don't cares. We define an {\em island} to be a maximal length substring of PP that does not contain don't cares. Let qq be the number of islands in PP. We present an algorithm that runs in O(nklogm+nmin{qklog2m3,qlogm})O(n\sqrt{k\log m}+n\min\{\sqrt[3]{qk\log^2 m},\sqrt{q\log m}\}) time. If the number of islands qq is O(k)O(k) this runtime becomes O(nklogm)O(n\sqrt{k\log m}), which essentially matches the best known runtime for pattern matching with kk mismatches without don't cares. If the number of islands qq is O(k2)O(k^2), this algorithm is asymptotically faster than the previous best algorithm for pattern matching with kk mismatches with don't cares in the pattern.

Keywords

Cite

@article{arxiv.1602.00621,
  title  = {On pattern matching with k mismatches and few don't cares},
  author = {Marius Nicolae and Sanguthevar Rajasekaran},
  journal= {arXiv preprint arXiv:1602.00621},
  year   = {2016}
}

Comments

Information Processing Letters, Available online 27 October 2016, ISSN 0020-0190