Knuth–Morris–Pratt algorithm: Difference between revisions

Content deleted Content added
Danilcha (talk | contribs)
Normalize the second example
Line 41:
==KMP algorithm==
 
===Example of the search algorithm===KMR , Kara Mohamed Raif ;
To illustrate the algorithm's details, consider a (relatively artificial) run of the algorithm, where <code>W</code> = "ABCDABD" and <code>S</code> = "ABC ABCDAB ABCDABCDABDE". At any given time, the algorithm is in a state determined by two integers:
 
Line 104:
S: ABC ABCDAB {{color|blue|ABCDAB}}{{color|red|C}}{{color|gray|DABDE}}
W: {{color|blue|ABCDAB}}{{color|red|D}}
i: {{color|blue|012345}}{{color|red|6}}
</span>