Hash algorithm implemented by hash table

I am looking for high speed hash functions with good (i.e. near uniform) distribution for hash implementation

Hash tables will be used exclusively to store values with integer keys

Can I use the lower bits of an integer as a hash?

For example, int key = n & 15; And create an array with 16 slots to store them

Any suggestions?

Solution

You can see xxhash here

The hash function you mentioned is very fast, but it is also very bad If you want a "stupid" hash function, maybe you can consider modulus

Example:

int key = item % size_of_hash_table
The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>