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 do you understand by term structured programming? Explain the structured programming as well.                                 Ans. S tructured Programming is expla

By changing the NULL lines in a binary tree to the special links called threads, it is possible to execute traversal, insertion and deletion without using either a stack or recursi

Define Strictly Binary Tree Strictly Binary Tree: - If each non leaf node in binary tree has non empty left and right sub-trees , then the tree is known as a strictly binary t

We would like to implement a 2-4Tree containing distinct integer keys. This 2-4Tree is defined by the ArrayList Nodes of all the 2-4Nodes in the tree and the special 2-4Node Root w

include int choice, stack[10], top, element; void menu(); void push(); void pop(); void showelements(); void main() { choice=element=1; top=0; menu()

As we have seen, as the traversal mechanisms were intrinsically recursive, the implementation was also easy through a recursive procedure. Though, in the case of a non-recursive me

Implement multiple stacks in a single dimensional array. Write algorithms for various stack operations for them.

HLS Colour Model  This model has the double-cone representation shown in Figure 3.40. The three colour parameters in this model are called hue (H), lightness (L), and Saturati

The number of interchanges needed to sort 5, 1, 6, 2 4 in ascending order using Bubble Sort is 5

an electrical student designed a circuit in which the impedence in one part of a series circuit is 2+j8 ohms and the impedent is another part of the circuit is 4-j60 ohm mm program