Efficient STRing CoMPares?
Paul F Smith
psmith at iies.ecn.purdue.edu
Thu Mar 21 07:36:15 AEST 1991
>In article barton at cbnewsk.att.com (jim.m.barton) writes:
>
> struct chunk
> {
> char *c_ptr;
> unsigned int c_hash;
> };
>
...
>
>You can also write great little symbol table implementations
>using hashing, and the hash values don't even have to take up
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>extra space (they're implicit in the bucket or slot indices).
^^^^^^^^^^^!!!
>
> Steve Summit
> scs at adam.mit.edu
OK, I won't ask about a string hash function :-), but could you
please elaborate on how your symbol table works. I just implemented a
hash table that keeps the hash value around (like your struct above),
which I then use in scanning the list at the given bucket to minimize
strcmp()s. But, I can't see how you can get rid of it and still reduce
the number of strcmp()s. Please describe, Thanks!
--
------------------------------------------------------------------
Paul F. Smith - ADPC - Purdue University psmith at ecn.purdue.edu
<someday I'll think of something profound to put here, maybe>
More information about the Comp.lang.c
mailing list