I’m using a very simple hash algorithm that map a string to an 32bit int, suppose the hash is bad, that both stringB and stringA got number 123, now should I traverse the linked list, try to compare all items with the item I’m looking for, until I find the right one ?
Share
Yes, a linked list per bucket is one way to do it: if the item is in the list, you are done; otherwise, add a new item at the end of the list.
The other is to try the next bucket in the table in a loop, until you find an empty one.