Talk:Rabin–Karp algorithm: Difference between revisions

Content deleted Content added
Line 197:
 
The whole article reads like a popular magazine article.
 
The text says: ''The hash function described here is not a Rabin fingerprint, but it works equally well.'' It does NOT work equally well; in fact it uses a rather poorly chosen prime number. A Rabin fingerprint is carefully designed to reduce collisions to a minimum, possibly to zero. The chosen hash function certainly does not.
 
Watch the technical language: the text says, ''The Rabin fingerprint is a popular and effective rolling hash function.'' No, it isn't a rolling hash function, it's just a hash function, a fingerprinting hash function, to be precise. The term 'rolling hash function' is imprecise diction in any case: rolling hashing is an algorithm that uses a hash function to produce successive hash codes over fixed- length portions of a string. Such a hash code might be called a 'rolling hash'. Furthermore, a Rabin fingerprint isn't confined to rolling hashes - it can be used anywhere a hash function is used.
Line 230 ⟶ 232:
 
I could go on, but that's enough for now. The article needs to be redrafted entirely for [[WP:TONE]], and it ''must, must, must'' be cited inline, every paragraph, factoid, piece of code or pesudocode, formula, or anything else that might constitute researched and referenceable content. [[User:Sbalfour|Sbalfour]] ([[User talk:Sbalfour|talk]]) 15:46, 26 September 2019 (UTC)
 
==Infeasability==
The algorithm as given is infeasable: it does ''m'' mods (i.e. divides) including doing the exponentiation, to subtract the high character from the running hash, times ''n'' character positions in the text string = ''nm'' mods. Divide is microprogrammed on modern architectures, and is maybe 3-5 timers slower than multiply, and maybe 50-100 times slower than ADD/XOR/SHIFT. You'll give back all or most of the advantage over linear hashing. [[User:Sbalfour|Sbalfour]] ([[User talk:Sbalfour|talk]]) 23:13, 26 September 2019 (UTC)