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 2 of 22
Question 1 of 17
Step 2 of 22
Step 3 of 22
Step 4 of 22
Step 5 of 22
Step 6 of 22
Step 7 of 22
Step 8 of 22
Step 9 of 22
Step 10 of 22
Question 1 of 17
Question 1 of 17
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:
o is not z, the first letter, and there is no shorter border left to fall back to.
Question 1 of 17
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:
o is not z, the first letter, and there is no shorter border left to fall back to.
Question 1 of 17
Right.
You guessed: The pattern letter compared next is not its first letter, and no shorter border is left.
What the run did:
o is not z, the first letter, and there is no shorter border left to fall back to.
Question 2 of 17
Question 2 of 17
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:
o is not z, the first letter, and there is no shorter border left to fall back to.
Question 2 of 17
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:
o is not z, the first letter, and there is no shorter border left to fall back to.
Question 2 of 17
Right.
You guessed: The pattern letter compared next is not its first letter, and no shorter border is left.
What the run did:
o is not z, the first letter, and there is no shorter border left to fall back to.
Question 3 of 17
Question 3 of 17
Not this time.
You guessed: Another letter is compared here, and it matches the pattern's.
What the run did:
The text's e at position 1 is not the pattern's z.
Question 3 of 17
Right.
You guessed: Another letter is compared here, and it is not the pattern's.
What the run did:
The text's e at position 1 is not the pattern's z.
Question 3 of 17
Not this time.
You guessed: No letter is left to compare, so the pattern stands here.
What the run did:
The text's e at position 1 is not the pattern's z.
Question 4 of 17
Question 4 of 17
Not this time.
You guessed: Some letters matched, so line the pattern up by their border.
What the run did:
Nothing matched here, so move the pattern on past this letter, to place 2.
Question 4 of 17
Right.
You guessed: Nothing matched here, so move the pattern on past this letter.
What the run did:
Nothing matched here, so move the pattern on past this letter, to place 2.
Question 5 of 17
Question 5 of 17
Not this time.
You guessed: Another letter is compared here, and it matches the pattern's.
What the run did:
The text's v at position 2 is not the pattern's z.
Question 5 of 17
Right.
You guessed: Another letter is compared here, and it is not the pattern's.
What the run did:
The text's v at position 2 is not the pattern's z.
Question 5 of 17
Not this time.
You guessed: No letter is left to compare, so the pattern stands here.
What the run did:
The text's v at position 2 is not the pattern's z.
Question 6 of 17
Question 6 of 17
Not this time.
You guessed: Some letters matched, so line the pattern up by their border.
What the run did:
Nothing matched here, so move the pattern on past this letter, to place 3.
Question 6 of 17
Right.
You guessed: Nothing matched here, so move the pattern on past this letter.
What the run did:
Nothing matched here, so move the pattern on past this letter, to place 3.