incorrect loop in hashSet
Closed this issue · 2 comments
matthewatabet commented
I believe there's an incorrect loop here:
https://github.com/Lamedh-Indonesia/sibiil-trac/blob/master/ht.c#L70
There's no need to check if next->next is NULL. The current logic results in new keys never being inserted at the end of existing buckets.
btw, this is a very nice reference implementation for a c hash! I enjoyed reading it :)
matthewatabet commented
never mind, read the code incorrectly. you're checking if next->key is NULL. sorry. closing this.
arinal commented
Glad to see someone enjoyed reading it but this implementation is never meant to be real world and actually it's highly influenced from here:
https://gist.github.com/tonious/1377667