Talk:2-choice hashing

Page contents not supported in other languages.
From Wikipedia, the free encyclopedia

Question[edit]

How is this different from Cuckoo hashing? Shashwat986talk 14:49, 7 May 2013 (UTC)[reply]

2-choice hashing is very similar to cuckoo hashing.
As far as I can tell, the only difference is in what happens during insertion when the two hash functions lead to two full buckets.
When both buckets are full, cuckoo hashing forces the new item into one of the buckets, pushing out some other item, then it forces that item into its other possible location, which if that bucket is full pushes out some other item, and so on. Usually cuckoo eventually finds some non-full bucket. When cuckoo doesn't eventually find a non-full bucket -- i.e., all of those buckets are full and cuckoo finds a loop -- cuckoo is forced to re-size the hash table or pick a new universal hash function or (as in most implementations) both.
When both buckets are full, 2-choice hashing (with fixed maximum-size buckets) immediately re-sizes the hash table or picks a new universal hash function or (as in most implementations) both.
As far as I can tell, in every other situation -- key lookups, key deletion, key insertion where at least one of the buckets is not yet full, key insertion where both buckets are full *and* cuckoo would find a loop, etc. -- both algorithms do exactly the same thing.
Should we say something about their similarities here in the 2-choice hashing article, or in the cuckoo hashing article, or in the hash table article that already mentions both of them? --DavidCary (talk) 16:26, 15 September 2015 (UTC)[reply]