考研操作系统笔记
Through the storm, we will find a way.
一寸先が闇なら、二寸先は明るい未来
始まりと終わりのプロローグ
-Turning Point-
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.