Hashing and collisions during hashing, Data Structure & Algorithms

Q. What do you understand by the term Hashing?  How do the collisions occur during hashing?  Explain the different techniques or methods for resolving the collision.                         

Ans:

Hashing permits us to access the record from the file directly no matter where the record is in the file. This is made possible with the help of a hashing function H which map the key with the corresponding key location. It provides the key- to- the address transformation.
Generally the key space is much larger than the address space, thus, many keys are mapped to the same address. Let us suppose that two keys K1 and K2 map to the same address. When the record by means of key K1 is entered, it is inserted at the hashed address, but when another record by means of key K2 is entered, it is a dilemma where to insert as a record by means of key K1 already exists there. This situation is termed as a hash collision. Two broad classes of collision resolution techniques or method are:
i) open addressing
ii) chaining.

The open addressing:  The easiest method to resolve a collision is to begin with the hash address and perform a sequential search through the table for an empty location.

In this the idea is to place the record in the next available location in an array. This method or technique is known as linear probing. An empty record is indicated by the special value called null. The major drawback or we can say limitation of the linear probe method is clustering.
Chaining: In this chaining technique or method, instead of hashing function value as location or address we use it as an index into an array of the pointers. Each pointer access a chain which holds the element having same location.

Posted Date: 7/10/2012 7:18:01 AM | Location : United States







Related Discussions:- Hashing and collisions during hashing, Assignment Help, Ask Question on Hashing and collisions during hashing, Get Answer, Expert's Help, Hashing and collisions during hashing Discussions

Write discussion on Hashing and collisions during hashing
Your posts are moderated
Related Questions
what happen''s in my computer when i input any passage

What is Keyed Access- Container A collection may allow its elements to be accessed by keys. For instance, maps are unstructured containers which allows their elements to be

Comparative Study of Linear and Binary Search Binary search is lots quicker than linear search. Some comparisons are following: NUMBER OF ARRAY ELEMENTS EXAMINED array

how can i delete from deque while deletion is restricted from one end

Q. Describe what do you understand by the term array? How does an array vary from an ordinary variable? How are the arrays represented in the specific memory?

Q. What do you understand by the term Binary Tree? What is the maximum number of nodes which are possible in a Binary Tree of depth d. Explain the terms given below with respect to

Q. Write down an algorithm to sort a given list by making use of Quick sort method. Describe the behaviour of Quick sort when input given to us is already sorted.

Data array A has data series from 1,000,000 to 1 with step size 1, which is in perfect decreasing order. Data array B has data series from 1 to 1,000,000, which is in random order.

In this section, we will discuss about Sequential file organization. Sequential files have data records stored in a particular sequence. A sequentially organized file might be stor

for (i = 0; i sequence of statements } Here, the loop executes n times. Thus, the sequence of statements also executes n times. Since we suppose the time complexity of th