home .. forth .. colorforth mail list archive ..

Re: [colorforth] longer words


fff

On Mon, 9 Aug 2004 14:51:36 -0400 (EDT), Mark Slicker <maslicke@xxxxxxxxxxx> wrote:

I found a simple hash function which results in 2 collisions in a very
large set of 118780 english words, using just the prefix results in 63312
collisions. Smaller sets (42869) result in no collisions. The hash is:

   h(0) = 0
   h(i+1) = h(i) + (h(i) SHR 7) + word(i)
   hash = h(n)

word(i) addresses the ith 32-bit word of a preparsed word of which there
are n.

In the case where n=1 the pre-parsed word is used as the hash, so this
should be a pretty fast hash.

Mark

---------------------------------------------------------------------
To unsubscribe, e-mail: colorforth-unsubscribe@xxxxxxxxxxxxxxxxxx
For additional commands, e-mail: colorforth-help@xxxxxxxxxxxxxxxxxx
Main web page - http://www.colorforth.com




---------------------------------------------------------------------
To unsubscribe, e-mail: colorforth-unsubscribe@xxxxxxxxxxxxxxxxxx
For additional commands, e-mail: colorforth-help@xxxxxxxxxxxxxxxxxx
Main web page - http://www.colorforth.com