Hash Functions

The lesson elaborates on Hash functions and how they work.

🔍 Hash Function?

A hash function simply takes a key of an item and returns a calculated index in the array for that item.

This index calculation can be a simple or a very complicated encryption method. However, it is very important to choose an efficient Hashing function, as it directly affects the performance of the Hashing mechanism.

What Hash Functions Do?

Have a look at the following illustration to get the analogy of a Hash function.

We can consider the Hash function as a method that takes key as an input and returns the corresponding index to that key.

Commonly Used Hash Functions

These are the most common hashing functions in use:

  • Arithmetic Modular

    Take mod of the key with the size of an array (called table)

index=key MOD t ...