这是什么模式匹配算法?

发布于 2024-11-19 08:16:28 字数 241 浏览 2 评论 0原文

我正在读《理论与实践》一书。数据结构问题(Seymour Lipschuz)。

让我提供我正在阅读的部分的图像。本书的链接

本书的这一部分讨论一种名为“第二模式匹配算法”的模式匹配算法。

这是什么算法?这是 Boyer-Moore、KMP、Horspool 还是什么?

或者说,这是作者提出的新算法吗?

I was reading the book Theory & Problems Of Data Struc (Seymour Lipschuz).

Let me provide an image of the section I was reading.link of this book.

This section of the book talks about a pattern-matching algorithm named "Second Patter-Matching Algorithm".

What algorithm is this? Is this Boyer-Moore or KMP or Horspool or what?

Or, is this any new algorithm produced by the author?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

带刺的爱情 2024-11-26 08:16:28

我相信这是 KMP 算法。 KMP 构建了一个“失败表”,本质上是一个自动机,它会说“如果您在某个特定字符上不匹配,那么您仍然可以匹配多少模式字符串?”它还对模式进行预处理,而不是对匹配的字符串进行预处理。此外,如果你看一下 Aho-Corasick 算法,它是 KMP 的推广,它构建了这个自动机的更通用版本,可以同时处理多种模式。因此,我很确定您正在考虑 KMP。

I believe that this is the KMP algorithm. KMP constructs a "failure table" that is essentially an automaton saying "if you mismatch on a particular character, how much of the pattern string can you still be matching?" It also does a preprocessing of the pattern and not the string being matched. Moreover, if you look at the Aho-Corasick algorithm, which is a generalization of KMP, it constructs a more general version of this automaton that works on multiple patterns at once. Consequently, I'm pretty sure that you're looking at KMP.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文