Content deleted Content added
Undo changes 06:43, 27 December 2017 Croesnick - no off-by-one error (length(T) = length(W) + 1) |
m Variable i renamed to k (for next edit) |
||
Line 135:
'''define variables''':
an integer, m ← 0 (the beginning of the current match in S)
an integer,
an array of integers, T (the table, computed elsewhere)
'''let''' nP ← 0
'''while''' m +
'''if''' W[
'''let'''
'''if'''
(occurrence found, if only first occurrence is needed, m may be returned at this point)
'''let''' P[nP] ← m, nP ← nP + 1
'''let''' m ← m +
'''else'''
'''let'''
'''else'''
'''if''' T[
'''let''' m ← m +
'''else'''
'''let''' m ← m +
===Efficiency of the search algorithm===
|