📢 Too many exams? Don’t know which one suits you best? Book Your Free Expert 👉 call Now!


    Question

    The Boyer-Moore algorithm is known for its efficiency in

    practice, especially for long patterns and large alphabets. It uses two heuristics: the bad character heuristic and the good suffix heuristic. Which direction does it typically start matching from?
    A From the beginning of the pattern. Correct Answer Incorrect Answer
    B From the middle of the pattern. Correct Answer Incorrect Answer
    C From the end of the pattern. Correct Answer Incorrect Answer
    D Randomly chooses a starting point. Correct Answer Incorrect Answer
    E From the beginning of the text. Correct Answer Incorrect Answer

    Solution

    Unlike Naive and KMP algorithms, the Boyer-Moore algorithm starts comparing the pattern with the text from the rightmost character of the pattern. This allows it to make larger shifts when a mismatch occurs, leveraging its bad character and good suffix heuristics.

    Practice Next
    ask-question