Article 2273 of alt.sources:
From: [email protected]
Subject: [comp.lang.c] Re: hash function for text in C
Message-ID: <[email protected]
Date: 18 Oct 90 18:44:51 GMT
Sender: [email protected]
Reply-To: [email protected]
Organization: U of Maryland, Dept. of Computer Science, Coll. Pk., MD 20742
Original-posting-by: [email protected]
Original-subject: Re: hash function for text in C
Reposted-by: [email protected]
[Reposted from comp.lang.c.
Comments on this service to [email protected]
The following implements expanding chained hash tables for strings and
numbers. This is unmodified from a special-purpose program (having to
do with reading a large number of files with name=id pairs and doing
various operations on them). Chain lengths are not monitored; instead,
the table is invariably expanded whenever it becomes 2/3 full. Entries
may be neither removed nor modified.
An essentially-unrelated function called `string' maintains a string
pool such that string(x) == string(y) iff strcmp(x,y)==0 (the program
typically stores each name several times, and often needs to test for
name equality, so this helps there).