开发者

Hashtable implementation for C

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 (e.g. 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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜