arXivDaily arXiv每日学术速递 周一至周五更新
感恩节,周五至周末无更新,大家顺遂。周一再来吧
arXiv cs/0606116cs.DS
收藏

正则表达式匹配的新算法

New Algorithms for Regular Expression Matching

Philip Bille

摘要:

在本文中,我们重新审视经典的正则表达式匹配问题,即,给定一个正则表达式$R$和一个字符串$Q$,决定是否$Q$匹配的字符串之一指定的$R$。令$m$和$n$分别为$R$和$Q$的长度。在一个标准的单位成本的RAM与字长$w \geq \log n$,我们表明,这个问题可以解决在$O(m)$空间与以下运行时间:\begin{equation*} \begin{cases} O(n\frac{m \log w}{w} + m \log w) & \text{if $m > w$} \\ O(n\log m + m\log m) & \text{if $\sqrt{w} < m \leq w$} \\ O(\min(n+ m^2, n\log m + m\log m)) & \text{if $m \leq \sqrt{w}$.} \end{cases} \end{equation*}这提高了最好的已知的时间界限之间的算法使用$O(m)$空间。无论何时$w \geq \log^2 n$,它都会改进所有已知的时间边界,而不管使用了多少空间。

英文摘要:

In this paper we revisit the classical regular expression matching problem, namely, given a regular expression $R$ and a string $Q$, decide if $Q$ matches one of the strings specified by $R$. Let $m$ and $n$ be the length of $R$ and $Q$, respectively. On a standard unit-cost RAM with word length $w \geq \log n$, we show that the problem can be solved in $O(m)$ space with the following running times: \begin{equation*} \begin{cases} O(n\frac{m \log w}{w} + m \log w) & \text{if $m > w$} \\ O(n\log m + m\log m) & \text{if $\sqrt{w} < m \leq w$} \\ O(\min(n+ m^2, n\log m + m\log m)) & \text{if $m \leq \sqrt{w}$.} \end{cases} \end{equation*} This improves the best known time bound among algorithms using $O(m)$ space. Whenever $w \geq \log^2 n$ it improves all known time bounds regardless of how much space is used.

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

↑