Re: Hash tables

From: Måns Rullgård (mru_at_inprovide.com)
Date: 03/29/05


Date: Tue, 29 Mar 2005 19:38:05 +0200

Russell Shaw <rjshawN_o@s_pam.netspace.net.au> writes:

> Hi,
>
> I made a hash table that usually holds less than 1000 entries, and the
> keys are text strings of 5-10 characters.
>
> Would a decent hash function be to just generate a 10 bit remainder
> by feeding the text into a 10 bit shift register which does a crc
> long division on it, then using that to index a 1024 entry array?
> (i'll use a maximal length generator polynomial)

I'm not sure how that would perform, but the well-known Jenkins' [1]
hash function is usually a good choice. It's in the public domain, to
top it off.

1. http://burtleburtle.net/bob/hash/doobs.html

-- 
Måns Rullgård
mru@inprovide.com


Relevant Pages

  • Re: Maximum String size in Java?
    ... > for long strings, so on average, SFH bakes it in the performance ... >> distribution over the hash table size. ... > you need to be concerned about Unicode strings. ... construct a hash function that does appreciably better than the one ...
    (comp.programming)
  • Re: String based hashCode
    ... String hash codes are not unique. ... small fixed set of strings. ... characters. ... a HashMap type of cache. ...
    (comp.lang.java.programmer)
  • Re: Some comments on "super fast hash"
    ... SFH seems reasonably good and certainly is fast. ... > a hash, and SFH does not. ... The latest versions of each hash function which leverages this ... it must behave worse on other key sets. ...
    (comp.programming)
  • [OT?] SDBM file HUGE on disk
    ... Most of the values are strings less than 20 characters ... Reading these data into a hash and tying that to an external file ...
    (comp.lang.perl.misc)
  • Re: String based hashCode
    ... String hash codes are not unique. ... small fixed set of strings. ... characters. ... I also know that EMPLOYEE-CATEGORY can not be bigger than ...
    (comp.lang.java.programmer)