Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Why do you need to maintain a reference to a hash node?

Or do you mean maintaining a reference to the value stored?

It seems to me that, even with a layer of indirection with a coocoo hashtable (i.e. your hash table is an array of pointers to elements), you still come out ahead with coocoo hashing as opposed to this method. If nothing else, your lookups are worst-case constant time.

In other words: what am I missing here?



> Why do you need to maintain a reference to a hash node?

> Or do you mean maintaining a reference to the value stored?

The hash node is the value stored; many hash tables are maps from keys to objects, and the objects get linked directly into the hash chain without further indirection.

The Linux kernel hash tables have a structure hlist_node which contains a next and previous pointer, and objects linkable into a hash table will contain an hlist_node as a field. This avoids having an extra level of indirection to get from a hash node to the hashed object.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: