Hash tables, hash function and hashing techniques, Data Structure & Algorithms

Assignment Help:

Q. Explain the Hash Tables, Hash function and Hashing Techniques properly?            

Ans.

Hash Table is explained as follows:

A hash table is a data structure in which the location or address of a data item is determined straight as a function of data item itself rather than by a series of comparison. Under ideal condition, the time required to locate a data item in a hash table is 0(1) ie. It is stable and DOES not rely on the number of data items saved. When the set of K of keys stored is much less than the universe U of all possible keys, a hash table need much less storage spare than a direct address table.

Hash Functions are explained below

A hash function h is simply a mathematical formula which manipulates the key in some form to finish the index for this key in the hash table. Eg a hash function can split the key by some number, generally the size of the hash table and return remainder as the index for the key. Usually, we say that a hash function h maps the universe U of keys into the slots of a hash table T[0....n-1]. This course  of  mapping  keys  to  appropriate slots  in  a  hash  table  is  termed  as hashing.

The major reconsideration for selecting hash function is :-

1)     It should be probable to compute it efficiently.

2)      It should distribute the keys uniformly across the hash table i.e. it should keep the number of collisions as small as possible.

Hashing Techniques are explained below:

There are number of hashing techniques. Some of them are given below:-

a) Division Method can be defined as:- In this method or technique, key K to be mapped into one of the m states in the hash table is spitted by m and the remainder of this spitted taken as index into the hash table. That is the hash function is

h(k) = k mod m

in which mod is the modules operation.

b)      Multiplication Method can be defined as: The multiplication method or techniques operates in 2 steps. In the 1st step the key value K is multiplied by a constant A in the range O

h(k) = [m (K A mod 1)]

where "K A mod 1" means the fractional part KA of KA-[KA].A A= (5-1/2)=0.6180334887

(c) Midsquare Method can be defined as:- this may operate in 2 steps. In the first step the square of the key value K is taken. In the 2nd step, the hash value is obtained by deleting digits from ends of the squared values ie. K2. The hash function is

h(k) = s

where s is obtained by deleting digits from both sides of K2.


Related Discussions:- Hash tables, hash function and hashing techniques

Calculate the k-th power and recursive algorithem, 1. The following is a r...

1. The following is a recursive algorithm to calculate the k -th power of 2. Input k a natural number Output kth power of 2 Algorithem: If k =0then return 1 Else return 2* po

Function performs multiplication of two numbers, You need to write a functi...

You need to write a function that performs multiplication of two numbers in your data structure. Again, remember how you multiply numbers in base 10 and you should be fine. Multipl

Programme in c to create a single linked list, Q. Write  down a   p...

Q. Write  down a   programme  in  C  to  create  a  single  linked  list also  write the functions to do the following operations (i)  To insert a new node at the end (ii

Explain how the shuttle sort algorithm works, Question 1 Explain how th...

Question 1 Explain how the shuttle sort algorithm works by making use of the following list of integers:11, 4, 2, 8, 5, 33, 7, 3, 1, 6. Show all the steps. Question 2

Linked list, create aset of ten numbers.then you must divide it into two s...

create aset of ten numbers.then you must divide it into two sets numbers which are set of odd numbers and set of even numbers.

Expression trees, What are the expression trees? Represent the below writte...

What are the expression trees? Represent the below written expression using a tree. Give a relevant comment on the result that you get when this tree is traversed in Preorder,

Determine the area subdivision method, Area Subdivision Method In this ...

Area Subdivision Method In this method, the viewport is examined for clear decisions on the polygons situated in it, in regard to their overlap and visibility to the viewer. Fo

Abstract data type-stack, Conceptually, the stack abstract data type mimics...

Conceptually, the stack abstract data type mimics the information kept into a pile on a desk. Informally, first we consider a material on a desk, where we might keep separate stack

Creation of a circular linked list, Program: Creation of a Circular linked ...

Program: Creation of a Circular linked list ALGORITHM (Insertion of an element into a Circular Linked List) Step 1        Begin Step 2      if the list is empty or new

Data flow diagrams, How to construct a data flow diagram for a college assi...

How to construct a data flow diagram for a college assignment and marking systemA

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