Hash tables with O(1) worst-case lookup and space efficiency [pdf]
11–20 of 45 posts
Re: Hash tables with O(1) worst-case lookup and space efficiency [pdf]
#12It's been my experience that the O(1) was on average, not worst case.
Re: Hash tables with O(1) worst-case lookup and space efficiency [pdf]
#13Cuckoo hashing is not only optimal in theory, it is also very fast in practice. The only downside, though, is that the insert time has linear-time worst case. Thus it may be not the best solution if latency is an issue.
"Linear-time worst case" is different from "amortized constant time", which is what cuckoo hashing provides. Almost all the containers we use on a regular basis provide only amortized constant time inserts.
In standard containers if you pre-define the capacity (say with std::vector::reserve) all the insertions are guaranteed to be constant time. Cuckoo hashing can't give this guarantee.
Re: Hash tables with O(1) worst-case lookup and space efficiency [pdf]
#14Re: Hash tables with O(1) worst-case lookup and space efficiency [pdf]
#15Cuckoo hashing is not only optimal in theory, it is also very fast in practice. The only downside, though, is that the insert time has linear-time worst case. Thus it may be not the best solution if latency is an issue.
Re: Hash tables with O(1) worst-case lookup and space efficiency [pdf]
#16Re: Hash tables with O(1) worst-case lookup and space efficiency [pdf]
#17Earlier quoted context omitted.
"Linear-time worst case" is different from "amortized constant time", which is what cuckoo hashing provides. Almost all the containers we use on a regular basis provide only amortized constant time inserts.
The linear time behavior of cuckoo hashing is not triggered only when the table has to be enlarged, like standard containers (say, std::vector or python list): a linear numbers of keys can be "cuckooed" out of their slots for an insertion even when the load factor is under the capacity threshold. In standard containers if you pre-define the capacity (say with std::vector::reserve) all the insertions are guaranteed to…
Re: Hash tables with O(1) worst-case lookup and space efficiency [pdf]
#18Earlier quoted context omitted.
The linear time behavior of cuckoo hashing is not triggered only when the table has to be enlarged, like standard containers (say, std::vector or python list): a linear numbers of keys can be "cuckooed" out of their slots for an insertion even when the load factor is under the capacity threshold. In standard containers if you pre-define the capacity (say with std::vector::reserve) all the insertions are guaranteed to…
I'm unaware of any hash table implementations which successfully insert elements in absolute constant time in the event of collisions.
Re: Hash tables with O(1) worst-case lookup and space efficiency [pdf]
#19Earlier quoted context omitted.
I'm unaware of any hash table implementations which successfully insert elements in absolute constant time in the event of collisions.
Chained hash tables have constant time insertion, but I'm not sure about the amortized lookup time (the worst case is linear)
Re: Hash tables with O(1) worst-case lookup and space efficiency [pdf]
#20Earlier quoted context omitted.
I'm unaware of any hash table implementations which successfully insert elements in absolute constant time in the event of collisions.
Chained hash tables have constant time insertion, but I'm not sure about the amortized lookup time (the worst case is linear)