Skip to content

Boyer-Moore-Horspool

words

Level 2 of 3

Also called Horspool's algorithm and Boyer-Moore-Horspool algorithm.

Finds every place a pattern stands in a text, skipping ahead. A table from the pattern says how far it may jump for each letter. At each place it compares from the pattern's last letter back, then jumps as far as the table allows for the text letter under the pattern's last letter.

the text, with the pattern under it

how far the pattern may jump, by the text letter under its last letter (* any other letter)

letters compared
0

step 1 of 1

Examples

A text of 2 to 10 letters, then a pattern of 1 to 6 letters, a to z only, separated by a comma or a space, for example banana, ana.