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

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


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.

Posted Date: 7/13/2012 1:22:28 AM | Location : United States

Related Discussions:- Hash tables, hash function and hashing techniques, Assignment Help, Ask Question on Hash tables, hash function and hashing techniques, Get Answer, Expert's Help, Hash tables, hash function and hashing techniques Discussions

Write discussion on Hash tables, hash function and hashing techniques
Your posts are moderated
Related Questions
Give the example of bubble sort algorithm For example List: - 7 4 5 3 1. 7 and 4 are compared 2. Since 4 3. The content of 7 is now stored in the variable which was h

How divide and conquer technique can be applied to binary trees?  As the binary tree definition itself separates a binary tree into two smaller structures of the similar type,

Problem Your LC code is stored in a memory location as shown and the variable name is LC                  LC Memory address       Content(LC code)

Q. Calculate that how many key comparisons and assignments an insertion sort makes in its worst case?        Ans: The worst case performance occurs in insertion

Q. Explain w hat are the stacks? How can we use the stacks  to check whether an expression is correctly parentheses or not. For example (()) is well formed but (() or )()( is not w

Q.1 Compare two functions n 2 and 2 n for various values of n. Determine when second becomes larger than first. Q.2 Why do we use asymptotic notation in the study of algorit

Determine the precondition of a binary search For instance, precondition of a binary search is that array searched is sorted however checking this precondition is so expensive

System defined data types:- These are data types that have been defined by the compiler of any program. The C language contains 4 basic data types:- Int, float,  char and doubl

What is quick sort?   Answer Quick sort is one of the fastest sorting algorithm used for sorting a list. A pivot point is chosen. Remaining elements are divided or portio

Double Linked List In a doubly linked list, also known as 2 way lists, each node is separated into 3 parts. The first part is called last pointer field. It has the address of t