Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Understanding Boyer-Moore string search algorithm's "Good Suffix Shift"-Table

Tags:

c

boyer-moore

Please help me to understand Boyer-Moore string search algorithm's "Good Suffix Shift"-Table.

What has happened when i==3?

There is no sub-string "_MAN" in the pattern. So the shift value should be 8 (as it was when i==1).

Why is it 6?

like image 984
user366312 Avatar asked Jun 24 '11 19:06

user366312


1 Answers

There is no sub-string "_MAN", but the string does start with "AN", so if you shift over by 6 you could get a pattern that matches as follows

_ M A N _ _ _ _ _ _
_ _ A N P A N M A N
like image 105
murgatroid99 Avatar answered Sep 21 '22 05:09

murgatroid99