Computing : O(m )

FA-Matcher(T, , m)
; O(n)

n = length(T)

s = *s*_{0}

for i = 1 to n

s = (s, T[i])

if s = *s*_{m}

then print ``Pattern occurs with shift'' (i-m)

This algorithm takes O(n + m
) time.