KMP Algorithm
1. Which of the following is the best description of a substring?
2. Which of the following is not a prefix of the string "algorithm"?
3. Which of the following is a suffix of the string "vlabs"?
4. Which of the following best describes the purpose of the LPS (Longest Prefix Suffix) array in the KMP algorithm?
5. What is the time complexity of the following recursive function?
def f(n):
if n == 0 or n == 1:
return 1
return f(n-1) + f(n-2)
6. Which of the following is NOT a valid step in the KMP preprocessing phase?