Questions: Boyer-Moore String Matching Algorithm

5 questions to test your understanding

Score: 0 / 5
Question 1 Multiple Choice

You are searching for an 8-character pattern in a text consisting entirely of the characters 'A' and 'B'. Which of the following best explains why Boyer-Moore performs poorly on this input?

ARight-to-left comparison is less efficient than left-to-right for binary alphabets
BThe bad-character rule rarely allows large skips because the mismatched character almost always appears in the pattern, shrinking skip distances toward 1
CThe good-suffix rule does not apply when the alphabet has only two symbols
DBoyer-Moore requires O(m²) preprocessing time for small alphabets
Question 2 Multiple Choice

Which of Boyer-Moore's two heuristics requires preprocessing the pattern into a table of shift values based on what was already matched before the mismatch?

AThe bad-character rule, because it indexes every character in the pattern
BThe good-suffix rule, because it uses the already-matched suffix to determine the safe shift
CBoth rules require identical preprocessing tables
DNeither rule requires preprocessing — shifts are computed at match time
Question 3 True / False

Boyer-Moore compares the pattern against the text from left to right, just like the naive algorithm.

TTrue
FFalse
Question 4 True / False

Boyer-Moore generally achieves better best-case performance on inputs with larger alphabets than on inputs with smaller alphabets.

TTrue
FFalse
Question 5 Short Answer

Why does Boyer-Moore's right-to-left comparison enable larger skips than left-to-right comparison, giving it sublinear best-case performance?

Think about your answer, then reveal below.