what is a good hashtable implementation for C? I need to use it with mpicc compiler. Delete function is not necessary.
The one in glib is very nice. Not sure if it's too large and/or possible to isolate from the rest of glib, though.
Failing that, Pearson hashing seems to be a good starting point for implementing your own (it's a hash function optimized for machines with 8-bit registers).
If the keys are all known in advance, you may use a perfect hash generator avoid the space overhead that is implicit in hash tables.
If, on the other hand, you really need a full hash table, I would suggest a variation of Cuckoo Hashing (eg the d-ary version).
I've used with satisfaction a simplified version of the Hopscotch Hashing that works rather well even at higher load factors.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.