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

preprint2016arXivOpen access

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(nklog⁡k)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(nklog⁡m+nmin⁡{qklog⁡2m3,qlog⁡m})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(nklog⁡m)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.

Explore this paper’s authors, topics and related work.

Building this map preview

BZPEER is loading the nearby papers, people, topics and institutions for this page.

Reviews 0

Write a reviewWrite

No reviews yet.

Discussion 0

Add a commentWrite

No comments yet.