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
Suppose there are exactly five packet switches (Figure 4) between a sending host and a receiving host connected by a virtual circuit line (shown as dotted line in figure 4). The tr

You are given an undirected graph G = (V, E) in which the edge weights are highly restricted. In particular, each edge has a positive integer weight of either {1,2,...,W}, where W

Q. Write an algorithm INSERT which takes a pointer to a sorted list and a pointer to a node and inserts the node into its correct position or place in the list.  Ans: /* s

The two famous methods for traversing are:- a) Depth first traversal b) Breadth first

Hear is given a set of input representing the nodes of a binary tree, write a non recursive algorithm that must be able to give the output in three traversal orders. Write down an

Ask queConsider the following functional dependencies: Applicant_ID -> Applicant_Name Applicant_ID -> Applicant_Address Position_ID -> Positoin_Title Position_ID -> Date_Position_O

Write down any four applications of queues.            Application of Queue (i)  Queue is used in time sharing system in which programs with the similar priority form a queu

Q. Write down any four applications or implementation of the stack.                                     Ans. (i)       The Conversion of infix to postfix form (ii)

Q. What is the need of using asymptotic notation in the study of algorithm? Describe the commonly used asymptotic notations and also give their significance.

HOW LINKED LIST HEADER WORKS? HOW TO INSERT AND DELETE ELEMENTS IN LINKED LIST?