Knuth–Morris–Pratt algorithm: Difference between revisions

Content deleted Content added
Minor correction of English
Line 144:
'''let''' i ← i + 1
'''if''' i = length(W) '''then'''
(occurrence found, if only first occurrence needis needed, m may be returned at this point)
'''let''' P[nP] ← m, nP ← nP + 1
'''let''' m ← m + i - T[i], i ← T[i] (T[length(W)] can't be -1)