August 6th, 2003, 01:29 PM
SOS!!! Hashing in C???
I am in a desperate situation to a C/C++ code . I tried all humanly possible ways to come thru it but in vain. I will be extremely thankful to anyone who could take a look at it and post me some help.
Thanks very much,
Use a hash table with chaining. That each each element in the hash table is a linked list of nodes, each node will hold information about a single string. The hash key is the string itself. We also must manage the linked list of nodes. To do so the string is hashed a second time to produce a "string id number". Each node in the list holds the string id number and the string. The list is kept in ascending order on the string id number.
In the above case, we hash the string S to get the linked list in the table, then we hash S a second time to get the string id. Because the linked list is sorted, we can quit searching the list as soon as we get a node containing an id number larger than that of S. S is the name of the character string..