KMP Algotirhm
Introduction
Presume we have a string S (length is m) and a pattern P (length is n) given as follow:
1 | index: 1 2 3 4 5 6 7 8 9 10 11 12 |
Now we want to find out is there a sub-string in S that matchs P exactly, which in this case is S[6:12].
That is what KMP algorithm does.



