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
The number of different directed trees with 3 nodes are ?? The number of disimilar directed trees with three nodes are 3

What is Ruby Ruby has numerous simple types, including numeric classes such as Integer, Fixnum, Bignum, Float, Big Decimal, Rational, and Complex, textual classes like String,

(1)  (i) Add the special form let to the metacircular interpreter Hint: remember let is just syntactic sugar for a lambda expression and so a rewrite to the lambda form is all t

how to implement multiple stack using single dimension array in c

QUESTION Explain the following data structures: (a) List (b) Stack (c) Queues Note : your explanation should consist of the definition, operations and examples.

ESO207: Programming Assignment 1 Due on 6 Sept, 2015. To be submitted online. Problem In this assignment you are required to implement k-way Merge Sort algorithm. In this version p

Normal 0 false false false EN-IN X-NONE X-NONE MicrosoftInternetExplorer4

explain quick sort algorithm

merging 4 sorted files containing 50 10 25 and 15 records will take time

What do we mean by algorithm? What are the characteristics of a good and relevant algorithm? An algorithm is "a step-by-step procedure for finishing some task'' An algorithm c