Slide 9
Slide 9 text
Algorithm
1. For some text and pattern (where the alphabet of pattern is a subset
of the alphabet of the text), construct the shift table for the entire
alphabet.
2. Align the pattern against the beginning of the text.
3. Starting with the last character in the pattern, compare the
character in the text.
On a match, compare the next character to the left trying to match them
all.
On a mismatch, look up the rightmost aligned character (not necessarily the
mismatched character!) from the text in the shift table. Then shift the
pattern to the right by the amount indicated in the shift table.
Repeat until the text matches, or until the text cannot match because the
pattern is longer than the remaining text.