# WHAT

Hashing is a process of generating a unique fixed-length code for a given input data using a hash function. It is used to store and retrieve data in a more efficient way.

## What is Hashing?

Want to practice Hashing Interview problems?

Want to practice Hashing Interview problems?

Collisions are bound to occur in hashing, so it's important to minimize them using collision resolution techniques. 2 major techniques are - - Separate Chaining  - Open Addressing

## Hashing Techniques

Here, each slot of the hash table points to a linked list of records that have the same hash value. It's used when we don't know exact number of keys to be inserted or deleted.

## 1. Separate Chaining

Want to practice Hashing Interview problems?

1. Simple to implement. 2. We can add any number of elements to the chain when needed.  3. It's not very dependent on the hash function or the load factor.

Want to practice Hashing Interview problems?

1. Use extra memory space and can lead to wasted space. 2. In the worst-case scenario, the search time can be O(n) if all keys belong to a single bucket.

Want to practice Hashing Interview problems?

In Open Addressing, all records are stored in the hash table itself, and the size of the table must be greater than or equal to the total number of keys available.

Want to practice Hashing Interview problems?

1. Linear Probing- In Linear Probing, we look for the next free slot in the hash table linearly. This can lead to clustering, reducing efficiency.

Want to practice Hashing Interview problems?

## 2. Quadratic Probing- In Quadratic Probing, we look for the next available slot in a quadratic sequence. This technique reduces clustering, leading to better performance.

Want to practice Hashing Interview problems?

## 3. Double Hashing- We apply a second hash function on key whenever a collision occurs. Also provides better performance.

Want to practice Hashing Interview problems?

### InterviewBit has got you covered with their collection of Hashing interview problems. Get started now and become a master problem solver!

Ready to become expert in solving Hasing Problems?

Step Up Your Game with InterviewBit Web Stories