Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Alice is studying the Boyer - Moore algorithm's bad character rule, and she notices that if a mismatch occurs on the left side of the

Alice is studying the Boyer-Moore algorithm's bad character rule, and she notices that if a mismatch occurs on the left side of the pattern, then the last occurrence table will more often than not be unhelpful. She thinks that one way to make the algorithm shift more effectively is to extend the last occurrence table from a HashMap from characters to indices to an array of HashMaps instead. The array is of length , and the HashMap at each will store the last occurrences of the characters in
.
Bob hears of Alice's change to the algorithm and agrees that the algorithm will shift correctly, and that the shifts will be more effective, but that it might not always be a good idea due to tradeoffs. Select all of the statements that apply.
Bob is correct that Alice's change will result in a correct algorithm for finding all occurrences.
Bob is incorrect about the correctness of the change; the change will cause the algorithm to miss occurrences.
Bob is correct that Alice's change will result in more effective shifts.
Bob is incorrect about the shifts made with the change; the shifts will still be naive shifts forward by 1 in most cases.
Bob's comment about the tradeoffs may be referring to the increased space complexity.
Bob's comment about the tradeoffs may be referring to the increased time complexity for computing the table.
Bob's comment about tradeoffs is either incorrect or most likely referring to something else entirely.
incorrect

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Beginning VB 2008 Databases

Authors: Vidya Vrat Agarwal, James Huddleston

1st Edition

1590599470, 978-1590599471

More Books

Students also viewed these Databases questions