arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 1509.09228cs.DS
收藏

字符串精确匹配的快速算法

Fast Algorithms for Exact String Matching

Srikrishnan Divakaran

摘要:

给定长度为$n$的模式字符串$P$和长度为$m$的查询字符串$T$,其中$P$和$T$的字符是从大小为$Δ$的字母表中提取的,{ \em精确字符串匹配}问题包括在$T$中查找所有出现的$P$。对于这个问题,我们提出的算法,在$O(nΔ^2)$时间预处理$P$,基本上确定$sparse(P)$,一个很少出现的子串$P$,然后用它来找到$P$在$T$有效的出现。我们的算法需要$O(m)$的最坏情况下的搜索时间,和$O(m/min(|sparse(P)|, Δ))$的预期搜索时间,其中$|sparse(P)|$至少是$δ$(即$P$中不同字符的数量),并且对于大多数模式字符串,它被观察到是$Ω(n^{1/2})$。

英文摘要:

Given a pattern string $P$ of length $n$ and a query string $T$ of length $m$, where the characters of $P$ and $T$ are drawn from an alphabet of size $Δ$, the {\em exact string matching} problem consists of finding all occurrences of $P$ in $T$. For this problem, we present algorithms that in $O(nΔ^2)$ time pre-process $P$ to essentially identify $sparse(P)$, a rarely occurring substring of $P$, and then use it to find occurrences of $P$ in $T$ efficiently. Our algorithms require a worst case search time of $O(m)$, and expected search time of $O(m/min(|sparse(P)|, Δ))$, where $|sparse(P)|$ is at least $δ$ (i.e. the number of distinct characters in $P$), and for most pattern strings it is observed to be $Ω(n^{1/2})$.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑