Knuth–Morris–Pratt algorithm: Difference between revisions

Content deleted Content added
I have tested in my computer, and the code before does not work well. The updates that I've made gave me Accepted on a Codeforces problem: http://codeforces.com/gym/101466/submission/29329077
Line 354:
'''while''' pos < length(W) do
'''let''' T[pos] ← cnd
'''ifwhile''' cnd > -1 and W[pos] <>!= W[cnd] '''then'''do
'''let''' cnd ← T[cnd] (to increase performance)
'''while''' cnd >= 0 and W[pos] <> W[cnd] do
'''let''' cnd ← T[cnd]
'''let''' pos ← pos + 1, cnd ← cnd + 1