Best hashing algorithm in terms of hash collisions and performance for strings

前端 未结 9 1147
忘掉有多难
忘掉有多难 2020-11-28 03:37

What would be the best hashing algorithm if we had the following priorities (in that order):

  1. Minimal hash collisions
  2. Performance

It doe

9条回答
  •  执念已碎
    2020-11-28 03:40

    Here is the Cuckoo Hash.

    Lookup requires inspection of just two locations in the hash table, which takes constant time in the worst case (see Big O notation). This is in contrast to many other hash table algorithms, which may not have a constant worst-case bound on the time to do a lookup.

    I think that fits into your criteria of collisions and performance. It appears that the tradeoff is that this type of hash table can only get 49% full.

提交回复
热议问题