Hashing and collisions during hashing, Data Structure & Algorithms

Assignment Help:

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.


Related Discussions:- Hashing and collisions during hashing

Graph traversal schemes, Q. Explain various graph traversal schemes and wri...

Q. Explain various graph traversal schemes and write their advantages and disadvantages. A n s . Graph Traversal Scheme is explained below In many troubles we wish

The complexity of searching an element, The complexity of searching an elem...

The complexity of searching an element from a set of n elements using Binary search algorithm is   O(log n)

Sort list of distinct numbers in ascending order - quicksort, (1) Sort a li...

(1) Sort a list of distinct numbers in ascending order, using the following divide- and-conquer strategy (Quicksort): divide the list of numbers into two lists: one that contains a

Binary tree, A binary tree is a tree data structures in which each node hav...

A binary tree is a tree data structures in which each node have at most two child nodes, generally distinguished as "right" and "left". Nodes with children are called parent nodes,

Graph, For the following graph find the adjacency matrix and adjacency list...

For the following graph find the adjacency matrix and adjacency list representation of the graph.

Registers, what are registers? why we need register? Definition? Types? Wha...

what are registers? why we need register? Definition? Types? What registers can do for us?

Define the internal path length, Define the Internal Path Length The In...

Define the Internal Path Length The Internal Path Length I of an extended binary tree is explained as the sum of the lengths of the paths taken over all internal nodes- from th

The data structure required to evaluate a postfix expression, The data stru...

The data structure needed to evaluate a postfix expression is  Stack

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd