Hashing with Open Addressing in Data Structure

Data StructureAnalysis of AlgorithmsAlgorithms

In this section we will see what is the hashing by open addressing. The open addressing is another technique for collision resolution. Unlike chaining, it does not insert elements to some other data-structures. It inserts the data into the hash table itself. The size of the hash table should be larger than the number of keys.

There are three different popular methods for open addressing techniques. These methods are −

  • Linear Probing

  • Quadratic Probing

  • Double Hashing

In this technique, we use a hash function like other hash techniques. If the place is free, then insert the element into that location. Now if that place is not free, we will find another free element by using some equations. For the linear probing, we will use some linear equations, for quadratic probing, we will use some quadratic equations.

In the double hashing, when a collision occurs, we will use another hash function, then put into that location. That hash function is called the secondary hash function. That will not be used directly, if there is no collision.

raja
Published on 10-Aug-2020 09:27:59
Advertisements