Properties of a good hash function
Now that we know what is a hash function, it should be clear that not all hash functions are the same. A good hash function for a specific type of input data (domain set) may perform poorly for other data types. How do we decide if a hash function is good or bad? A few properties of a hash function decide if it is good or bad. Some of them are given below.
Uniformity
A good hash function maps elements in the domain set(keys) to elements in the co-domain set(hash values) as uniformly as possible. Some hash functions, like the mod function, are uniform. In a perfectly uniform function, every element in the co-domain set should be mapped to the same number of elements in the domain set.
Liking the course? Check our discounted plans to continue learning.