hashtable implementation in C?

最后都变了- 提交于 2019-12-10 19:58:48

问题


I was wondering if you knew of a robust implementation of a hashtable in C. I'm looking for something other than ghashtable in glib. Thanks.


回答1:


I've heard good things about the GLib Hash Table.




回答2:


Will this hashtable work? (got the link from the second post of this thread)

Perhaps this one will?

(got the above from a Google search for "hashtable in c", am not a C programmer)




回答3:


For a hash table I'd use google-sparsehash

PD: I don't know your requirements, but take a look at HDF5, bear in mind it exists just in case.

update

Memory Structures Library (MemSL2), o MemSL2 in another link it has implementations (one in pure C and wrappers for C++) of structures, for example, AVL trees, threaded trees, ..., and

  • Hash Tables with Separate Chaining,
  • Hash Tables with User-Defined Paging
  • Hash Tables with Dynamic Paging



回答4:


A simple one in libc, see <hsearch.h> and man hsearch.

Update: just found that you can implement hashtable very easily with the help of hlist from Linux kernel. Take a look at <list.h> in Linux kernel source code for hlist_head/node and their operations.




回答5:


You might want to look into using the Apache Portable Runtime? It's license is very liberal and it provides a decent hashtable implementation:

http://apr.apache.org/docs/apr/1.3/group__apr__hash.html



来源:https://stackoverflow.com/questions/2933458/hashtable-implementation-in-c

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!