TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Ken Thompson: Regular Expression Search Algorithm [pdf]

2 点作者 l0stman超过 14 年前

1 comment

lukesandberg超过 14 年前
i have actually been implementing this algorithm in c using a VM based approach. there are analyses of these techniques that are a little less dense than whats in the paper here: <a href="http://swtch.com/~rsc/regexp/regexp1.html" rel="nofollow">http://swtch.com/~rsc/regexp/regexp1.html</a> and <a href="http://swtch.com/~rsc/regexp/regexp2.html" rel="nofollow">http://swtch.com/~rsc/regexp/regexp2.html</a><p>the really amazing thing about this algorithm is stated in the third to last paragraph where he explains that strict bounds can be put on the size of the two lists that are used to manage the runtime state. this turns the algorithm from a potentially exponential runtime to O(MN) where M is the size of the regex and N is the length of the string being matched