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)
Explanation

Explanation

Explanation

Explanation

Explanation

Explanation

Explanation

Explanation

2. Given the pattern to be found, which of the following is the correct LPS array?
Pattern = AABAAC
Explanation

Explanation

Explanation

Explanation

Explanation

Explanation

Explanation

Explanation

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"

Explanation

Explanation

Explanation

Explanation

Explanation

4. Which of the following is a key advantage of KMP over the naive string searching algorithm?
Explanation

Explanation

Explanation

Explanation

Explanation

Explanation

Explanation

Explanation

5. Which of the following best describes the role of the LPS array in the KMP algorithm?
Explanation

Explanation

Explanation

Explanation

Explanation

Explanation

Explanation

Explanation

6. Which of the following is NOT a valid property of the KMP algorithm?
Explanation

Explanation

Explanation

Explanation

Explanation

Explanation

Explanation

Explanation