Talk:Rabin–Karp algorithm: Difference between revisions

Content deleted Content added
Suggestions
Line 55:
'''2''' hsub := hash(sub[1..m])
'''3''' '''for''' i '''from''' 1 '''to''' n
'''74''' hs := hash(s[i..i+m-1])
'''45''' '''if''' hs = hsub
'''56''' '''if''' s[i..i+m-1] = sub
'''67''' '''return''' i
'''78''' '''return''' not found
 
Aside from being a line shorter, I find this more clearly displays what hs is for any given iteration. The same comment applies to the other example of multi-pattern matching.