For pattern ababab, the prefix table records how much of the pattern remains useful after a mismatch.
Read the related guide · · Bookmark this unique URL with Ctrl/Cmd+D.
Knuth-Morris-Pratt search reuses matched-prefix information so a mismatch does not restart comparison at the next text character. Experiment with a small example and see each step update.
For pattern ababab, the prefix table records how much of the pattern remains useful after a mismatch.
Read the related guide · · Bookmark this unique URL with Ctrl/Cmd+D.