← Quiz: String Matching — KMP and Rabin-Karp: all 10 questions
Quiz: String Matching — KMP and Rabin-Karp · Question 10 of 10
A string has length 9 and lps[8] = 6. What does that tell you?
A string has length 9 and lps[8] = 6. What does that tell you?
- A.It has no repeated block
- B.Its first 6 letters are all the same
- C.It is a palindrome
- D.It is made of a block of length 9 − 6 = 3 repeated, because 3 divides 9
Answer & explanation
Correct answer: It is made of a block of length 9 − 6 = 3 repeated, because 3 divides 9
For example "abcabcabc": the period p = n − lps[n − 1] = 3 divides 9.
Can you get the rest right without peeking?
Take the timed Quiz: String Matching — KMP and Rabin-Karp quiz free. Pass it to earn XP and count towards your certificate.
Start the quiz →