Data Structure (2130702)

BE | Semester-3   Winter-2016 | 01/02/2017

Q3) (b)

Discuss various rehashing techniques.

1. Division-Method
In this method we use modular arithmetic system to divide the key value by some integer divisor m (may be table size). It gives us the location value, where the element can be placed.
2. Midsquare Methods
In this case, we square the value of a key and take the number of digits required to form an address, from the middle position of squared value. Suppose a key value is 16, then its square is 256. Now if we want address of two digits, then you select the address as 56 (i.e. two digits starting from middle of 256).
3. Folding Method
Most machines have a small number of primitive data types for which there are arithmetic instructions. Frequently key to be used will not fit easily in to one of these data types. The solution is to combine the various parts of the key in such a way that all parts of the key affect for final result such an operation is termed folding of the key.
4. Digit Analysis
This hashing function is a distribution-dependent. Here we make a statistical analysis of digits of the key, and select those digits (of fixed position) which occur quite frequently. Then reverse or shifts the digits to get the address.
5. Length Dependent Method
In this type of hashing function we use the length of the key along with some portion of the key j to produce the address, directly. In the indirect method, the length of the key along with some portion of the key is used to obtain intermediate value.