Thursday, September 18, 2014

Java - Hash Tables

A simple hash function:
h(k)=k mod N.
If a hash function is chosen well, it should guarantee that the probability that two different keys get hashed to the same bucket is at most 1/N. Therefore, instead, the below hash function is more appropriate:
h(k)= (ak+b) mod N.

No comments:

Post a Comment