






Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!







m h p ← 0 ← d← length[ P ]m-1 (^) mod q t for 0 ← 0 i ← 1 do p ← ( dp + P[ i ] ) mod q to m ► Preprocessing for s ← 0 do if^ t^0 p = t to ← ( dt ns – m^0 + T[ i ] ) mod q ► Matching if s < n^ then if – m^ then^ P[ 1..m ] = T[ s+1 .. s+m ]^ print “Pattern occurs with shift” s then ts+1 ← ( d * ( ts – T[ s + 1 ] * h ) + T[ s + m + 1 ] ) mod q