Question: 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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!