This algorithm was coined out by Knuth, Morris and
Pratt. It is a linear time string-matching algorithm.
Text
Pattern
Now by comparing the text with the pattern
Text
Pattern
Text
Pattern
 Here is a match. And the substring search will return index number 0.
 Now compare only the fourth 1 of the pattern with the fourth character of the text.
 As it is already known that the first three characters will already match and hence
skip the first three characters of the pattern while matching.
Hey Friends,
This was just a summary on Knuth–Morris–Pratt algorithm. For more
detailed information on this topic, please type the link given below or copy it
from the description of this PPT and open it in a new browser window.
http://www.transtutors.com/homework-help/computer-science/knuth-marris-
pratt-algorithm.aspx

Knuth–Morris–Pratt Algorithm | Computer Science

  • 1.
    This algorithm wascoined out by Knuth, Morris and Pratt. It is a linear time string-matching algorithm.
  • 2.
    Text Pattern Now by comparingthe text with the pattern Text Pattern
  • 3.
    Text Pattern  Here isa match. And the substring search will return index number 0.  Now compare only the fourth 1 of the pattern with the fourth character of the text.  As it is already known that the first three characters will already match and hence skip the first three characters of the pattern while matching.
  • 4.
    Hey Friends, This wasjust a summary on Knuth–Morris–Pratt algorithm. For more detailed information on this topic, please type the link given below or copy it from the description of this PPT and open it in a new browser window. http://www.transtutors.com/homework-help/computer-science/knuth-marris- pratt-algorithm.aspx