Talk:Rabin–Karp algorithm: Difference between revisions

Content deleted Content added
Dcoetzee (talk | contribs)
=: Agree
Line 8 of the muli-pattern-search pseudo-code seems wrong to me
Line 18:
--[[User:129.254.65.18|129.254.65.18]] 08:35, 23 May 2005 (UTC)
:I agree with you. We are assuming m ≤ n, and if [1..n] is used, the algorithm won't work, because it'd be trying to compare hashes of strings of length ''n'' to hashes of strings of length ''m''. [[User:Dcoetzee|Deco]] 21:41, 23 May 2005 (UTC)
 
== Line 8 of the muli-pattern-search pseudo-code seems wrong to me ==
 
Quote: if s[i..i+m-1] = a substring with hash hs
This is exactly the same condition as in the line above (element of hash).
As pointed out corretly in the single patters search - to rule out a hash collision we need to compare with the actual search string(s). (Plural only if by fat chance or denial of service attack, two search strings have the same hash.)
 
Or am I missing something obvious here?