具有k个不匹配和少数无关的模式匹配
On pattern matching with k mismatches and few don't cares
摘要:
我们考虑了具有$k$不匹配的模式匹配问题,其中模式中可能存在无关字符或通配符。具体来说,给定长度为$m$的模式$P$和长度为$n$的文本$T$,我们希望找到$T$中所有不超过$k$的$P$。模式可以有无关字符,它匹配任何字符。如果没有无关紧要,用于具有$k$不匹配的模式匹配的最知名算法具有$O(n\sqrt{k \log k})$的运行时间。在模式中使用“无关”时,最好的确定性算法的运行时间为$O(nk polylog m)$。因此,有和没有不关心的版本之间有一个重要的差距。在本文中,我们给出了一个算法,其运行时间增加的不关心的数量。我们将{ \em island}定义为$P$的最大长度子串,该子串不包含无关字。令$q$为$P$中岛的数量。我们提出了一个算法,运行在$O(n\sqrt{k\log m}+n\min\{\sqrt[3]{qk\log^2 m},\sqrt{q\log m}\})$时间。如果岛$q$的数量为$O(k)$,则该运行时变为$O(n\sqrt{k\log m})$,其基本上匹配具有$k$不匹配的模式匹配的最佳已知运行时,而不关心。如果岛$q$的数量是$O(k^2)$,则该算法渐进地快于先前的用于具有$k$不匹配且模式中不关心的模式匹配的最佳算法。
英文摘要:
We consider the problem of pattern matching with $k$ mismatches, where there can be don't care or wild card characters in the pattern. Specifically, given a pattern $P$ of length $m$ and a text $T$ of length $n$, we want to find all occurrences of $P$ in $T$ that have no more than $k$ 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 $k$ mismatches has a runtime of $O(n\sqrt{k \log k})$. With don't cares in the pattern, the best deterministic algorithm has a runtime of $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 $P$ that does not contain don't cares. Let $q$ be the number of islands in $P$. We present an algorithm that runs in $O(n\sqrt{k\log m}+n\min\{\sqrt[3]{qk\log^2 m},\sqrt{q\log m}\})$ time. If the number of islands $q$ is $O(k)$ this runtime becomes $O(n\sqrt{k\log m})$, which essentially matches the best known runtime for pattern matching with $k$ mismatches without don't cares. If the number of islands $q$ is $O(k^2)$, this algorithm is asymptotically faster than the previous best algorithm for pattern matching with $k$ mismatches with don't cares in the pattern.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。