Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.

A lot of efficient algorithms including KMP and BM are in this frame ※Masayuki Taketa “High-speed pattern matching algorithms for full text processing,” Informatics symposium, January 1991(written in Japanese).

The values of two functions (delta1 and delta2) are compared, and thenthe pattern is shifted by the larger.

Although the time complexity of BM algorithm is O(mn) in the worst case, it becomes O(n/m) on average（sub linear!!）

delta1(char) := the jump width of which we shift the pattern so that the rightmost position of char in P is aligned to the current text position (if the pattern doesn’t include char, then it is equal to the pattern length).

delta2(j) := the jump width of which we shift to align the suffix of P of lengthj-1 with another factor of P （or the longest prefix of P such that it is also the suffix of the string）（If there isn’t such factor, it is equal to the length of P.）

delta2(3) = 8

(good-suffix heuristic)

Text T:

a a b c d a a b b c a b c c a ・・・

※There are two candidate, 1 and 5, for the value of delta2(3). However, we can see that the left side character of the 5th, namely the 4th, is ‘b’ , which doesn’t match with ‘a’. Therefore, the 1st position is the only candidate.

Commentz-WalteralgorithmB. Commentz-Walter. A string matching algorithm fast on the average. In Proceedings of the 6th International Colloquium on Automata, Languages and Programming, LNCS71:118-132, 1979.

A straight extension of BM algorithm

Set Horspool algorithm

A simplified algorithm of Commentz-Walter based on the idea of Horspool