KMP Algorithm
1. What is the time complexity of the KMP Algorithm? (M = length of pattern, N = length of string in which pattern is searched)
2. Given the pattern to be found, which of the following is the correct LPS array?
Pattern = AABAAC
Pattern = AABAAC
3. Given Input String and Pattern, find the first index of the input string that matches the pattern using the KMP algorithm.
Input String = "TSATLEADSAT"
Pattern = "SAT"
Input String = "TSATLEADSAT"
Pattern = "SAT"
4. What is the main advantage of the KMP algorithm over the naive string matching algorithm?
5. In the LPS array construction, what does LPS[i] represent?