Question: Design an algorithm that is as efficient as possible that calculates the maximum number of directly consecutive occurrences of A in B for two strings

Design an algorithm that is as efficient as possible that calculates the maximum number of directly consecutive occurrences of A in B for two strings AEEm and BEEn, , ie your algorithm should have the largest number p Determine NO for which B =x*(A^p)*y, where x, y EE.. A`p represents the concatenation of p occurrences of A. Then determine the asymptotic runtime of your algorithm and illustrate how your algorithm works an example. Example: For "A=bca and B = cbcabcaacbca p = 2. A has three occurrences in B, but only two of them follow one another: B = c(bca) Zac (bca) = xA2y with x = cand y = acbca
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
