next up previous
Next: Up: Previous:

Analysis

Computing $\delta$: O(m \(\mid \Sigma \mid\))



FA-Matcher(T, $\delta$, m) $\;\;\;\;\;$ $\;\;\;\;\;$; O(n)
$\;\;\;\;\;$n = length(T)
$\;\;\;\;\;$s = s0
$\;\;\;\;\;$for i = 1 to n
$\;\;\;\;\;$ $\;\;\;\;\;$s = $\delta$(s, T[i])
$\;\;\;\;\;$ $\;\;\;\;\;$if s = sm
$\;\;\;\;\;$ $\;\;\;\;\;$then print ``Pattern occurs with shift'' (i-m)



This algorithm takes O(n + m \(\mid \Sigma \mid\)) time.


next up previous
Next: Up: Previous: