Question: (20 points) Give an algorithm that takes in two string a and B. of length n and m, and finds the longest suffix of a

(20 points) Give an algorithm that takes in two string a and B. of length n and m, and finds the longest suffix of a that exactly matches a prefix of B. The algorithm should run in O(n + m) time. (Hint: your algorithm will likely rely on the fact that the Zi(S) values can be computed in time thats linear with respect to the length of a string S). Your response should not only include a high level) description of the algorithm in english prose (with additional pseudocode if absolutely necessary) but a description of: (1) why the algorithm defined solved the problem and does not leave any corner cases, as well as (2) an analysis of the running time to ensure that it fulfills the questions requirements
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
