Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!samsung!noose.ecn.purdue.edu!iies.ecn.purdue.edu!psmith From: psmith@iies.ecn.purdue.edu (Paul F Smith) Newsgroups: comp.lang.c Subject: Re: Efficient STRing CoMPares? Message-ID: <1991Mar20.213615.11223@noose.ecn.purdue.edu> Date: 20 Mar 91 21:36:15 GMT References: <15486@smoke.brl.mil> <1991Mar19.034802.24340@cbnewsk.att.com> <1991Mar20.020957.9180@athena.mit.edu> Sender: root@noose.ecn.purdue.edu (ECN System Management) Organization: ADPC, Purdue University Lines: 30 >In article barton@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@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@ecn.purdue.edu