1

No hash function can guarantee a good distribution. All you can do is finding a hash function that will usually create a good distribution. The table size is quite important for this: If the table size is a prime p, then just using n modulo p as the hash value is usually quite good. Note that in your case, 4 is not a prime. Actually all your values are ...


Only top voted, non community-wiki answers of a minimum length are eligible