guess the next step: Knuth-Morris-Pratt
Before each step plays, guess what it does. The page then shows the step as the run takes it and says why, the same sentence the watch page says there.
Step 12 of 35
Question 7 of 27
Step 12 of 35
Step 13 of 35
Step 14 of 35
Step 15 of 35
Step 16 of 35
Step 17 of 35
Step 18 of 35
Step 19 of 35
Question 7 of 27
Question 7 of 27
Not this time.
You guessed: The pattern letter compared next matches the letter after the border, so the border grows by one.
What the run did:
b is not a, the letter after a border 2 letters long. Fall back to that border's own border, 1 letter long, and compare again.
Question 7 of 27
Right.
You guessed: The pattern letter compared next is not the letter after the border, so fall back to a shorter border.
What the run did:
b is not a, the letter after a border 2 letters long. Fall back to that border's own border, 1 letter long, and compare again.
Question 7 of 27
Not this time.
You guessed: The pattern letter compared next is not its first letter, and no shorter border is left.
What the run did:
b is not a, the letter after a border 2 letters long. Fall back to that border's own border, 1 letter long, and compare again.
Question 8 of 27
Question 8 of 27
Not this time.
You guessed: The pattern letter compared next matches the letter after the border, so the border grows by one.
What the run did:
b is not a, the letter after a border 1 letter long. Fall back to that border's own border, of nothing, and compare again.
Question 8 of 27
Right.
You guessed: The pattern letter compared next is not the letter after the border, so fall back to a shorter border.
What the run did:
b is not a, the letter after a border 1 letter long. Fall back to that border's own border, of nothing, and compare again.
Question 8 of 27
Not this time.
You guessed: The pattern letter compared next is not its first letter, and no shorter border is left.
What the run did:
b is not a, the letter after a border 1 letter long. Fall back to that border's own border, of nothing, and compare again.
Question 9 of 27
Question 9 of 27
Not this time.
You guessed: The pattern letter compared next matches the letter after the border, so the border grows by one.
What the run did:
b is not a, the first letter, and there is no shorter border left to fall back to.
Question 9 of 27
Not this time.
You guessed: The pattern letter compared next is not the letter after the border, so fall back to a shorter border.
What the run did:
b is not a, the first letter, and there is no shorter border left to fall back to.
Question 9 of 27
Right.
You guessed: The pattern letter compared next is not its first letter, and no shorter border is left.
What the run did:
b is not a, the first letter, and there is no shorter border left to fall back to.
Question 10 of 27
Question 10 of 27
Right.
You guessed: Another letter is compared here, and it matches the pattern's.
What the run did:
The text's a at position 1 matches the pattern's a.
Question 10 of 27
Not this time.
You guessed: Another letter is compared here, and it is not the pattern's.
What the run did:
The text's a at position 1 matches the pattern's a.
Question 10 of 27
Not this time.
You guessed: No letter is left to compare, so the pattern stands here.
What the run did:
The text's a at position 1 matches the pattern's a.
Question 11 of 27
Question 11 of 27
Right.
You guessed: Another letter is compared here, and it matches the pattern's.
What the run did:
The text's a at position 2 matches the pattern's a.
Question 11 of 27
Not this time.
You guessed: Another letter is compared here, and it is not the pattern's.
What the run did:
The text's a at position 2 matches the pattern's a.
Question 11 of 27
Not this time.
You guessed: No letter is left to compare, so the pattern stands here.
What the run did:
The text's a at position 2 matches the pattern's a.
Question 12 of 27
Question 12 of 27
Right.
You guessed: Another letter is compared here, and it matches the pattern's.
What the run did:
The text's a at position 3 matches the pattern's a.
Question 12 of 27
Not this time.
You guessed: Another letter is compared here, and it is not the pattern's.
What the run did:
The text's a at position 3 matches the pattern's a.
Question 12 of 27
Not this time.
You guessed: No letter is left to compare, so the pattern stands here.
What the run did:
The text's a at position 3 matches the pattern's a.