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 irc in iririrc. How many comparisons does it make?
the answer, and why
the answer is B
The table: i jumps 2, r 1, any other letter 3. At places 1 and 3, the text's i is not the pattern's c, 1 each, and i jumps 2. Place 5: c, r and i match, 3. c stands only last in irc, so it is not in the table: it jumps 3, past the end. That is 5.
if you chose another
AThat is brute force: it tries all 5 places and compares from the front, 3 + 1 + 3 + 1 + 3.
CThat counts place 5's matches but not the comparisons at places 1 and 3.
DThat tries places 2 and 4 as well, which i's jump of 2 skips.