开发者

What pattern-matching algorithm is this?

开发者 https://www.devze.com 2023-03-18 05:14 出处:网络
I was reading the book Theory & Problems Of Data Struc (Seym开发者_开发知识库our Lipschuz).

I was reading the book Theory & Problems Of Data Struc (Seym开发者_开发知识库our Lipschuz).

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

What pattern-matching algorithm is this?

.

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?


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消