Also called Horspool's algorithm and Boyer-Moore-Horspool algorithm.
fresh numbers
The test's questions that a run answers, asked again on new numbers whenever you like. The answer, its working and the reason for every other choice come from boyer-moore-horspool's own run on the numbers shown.
choose one
1question 1
Horspool looks for ati in atatatati. How many comparisons does it make?
the answer, and why
the answer is D
The table: a jumps 2, t 1, any other letter 3. At places 1, 3 and 5, the text's a is not the pattern's i, 1 each, and a jumps 2. Place 7: i, t and a match, 3. i stands only last in ati, so it is not in the table: it jumps 3, past the end. That is 6.
if you chose another
AThat is brute force: it tries all 7 places and compares from the front, 3 + 1 + 3 + 1 + 3 + 1 + 3.
BThat counts place 7's matches but not the comparisons at places 1, 3 and 5.
CThat tries places 2, 4 and 6 as well, which a's jump of 2 skips.