Content deleted Content added
Rabin-Karp does not predate KMP, which was published in 1977! |
→Use of hashing for shifting substring search: reverting the RK pseudocode on obtaining an initial hash value |
||
Line 28:
'''1''' '''function''' RabinKarp(''string'' s[1..n], ''string'' sub[1..m])
'''2''' hsub := hash(sub[1..m])
'''3''' hs := hash(s[1..
'''4''' '''for''' i '''from''' 1 '''to''' n
'''5''' '''if''' hs = hsub
|