Docsity
Docsity

Prepare for your exams
Prepare for your exams

Study with the several resources on Docsity


Earn points to download
Earn points to download

Earn points by helping other students or get them with a premium plan


Guidelines and tips
Guidelines and tips

Hashing Algorithms: Techniques and Collision Resolution, Slides of Design and Analysis of Algorithms

An overview of hashing algorithms, their functions, methods, and collision resolution techniques. Hashing is a technique used to store and retrieve data quickly by converting keys into hash values and using them as indices in a hash table. The direct method, division method, mid-square method, and folding method for generating hash values, as well as collision resolution techniques such as open addressing and separate chaining.

Typology: Slides

2017/2018

Uploaded on 10/25/2018

Radhika_chandok
Radhika_chandok 🇮🇳

1 document

1 / 17

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
HASHING
Presented
By:-
Radhika
MCA
5th
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff

Partial preview of the text

Download Hashing Algorithms: Techniques and Collision Resolution and more Slides Design and Analysis of Algorithms in PDF only on Docsity!

HASHING

Presented

By:-

SummarySummary  (^) Hashing stores the data in such a way that it can retrieved very quickly.  (^) Hashing is also known as Hashing Algorithm or Message Digest Function.  (^) It is a technique to convert a range of key values into a range of indexes of an array.  (^) Hashing allows to update and retrieve any data entry in a constant time O(1).

Hash Table Hash Table  (^) Hash table or hash map is a data structure used to store key-value pairs.  (^) It is a collection of items stored to make it easy to find them later.  (^) It uses a hash function to compute an index into an array.

Hash Methods Hash Methods

Direct

Method

Division

Method

Midsqu

are

Method

Folding

Method

Division Method Division Method  (^) In this method, the key is divided by some integer and the remainder is taken as the index of the hash table.  (^) It is also known as modulo-division method 234 431 94 7 98 1 792 Exampl e:- Assume:- Table size = 13 H(k):- 0 2 11 6 12 Remain der

Midsquare Method Midsquare Method  (^) In this method, the key is squared and index of the hash table is obtained by selecting an appropriate number of digits from the middle of the square. K = 4012 K (sqr) = 16096144 H (k) = 96 Exampl e:- K = 1001 K (sqr) = 1010001 H (k) = 100

CollisionCollision  (^) If ,when an element is inserted, it hashes to the same value as an already inserted element, then we have a collision and need to resolve it.  (^) A method that is used to resolve the collision in hash function is called Collision Resolution.

Collision Resolution Techniques Collision Resolution Techniques Open Addressi ng Separate Chaining

Linear Probing Linear Probing  (^) If the current location is used, Try the next table location.  (^) Used less memory than chaining Exampl e:- 21,22, , % 5 = 21 22 11 32

1,2,1, 2

Quadratic Probing Quadratic Probing  (^) Quadratic Probing operates by taking the original hash index and adding successive values of an arbitrary quadratic polynomial until an open slot is found. H (x) = (h(k) + f(i)) mod size i Exampl e:- 21,22, , % 5 = 1,2,1, 2 11 21 22 32

Advantages & Disadvantages Advantages & Disadvantages

Advantages Disadvantages

 (^) Reliable method of data retrieval  (^) Difficult for sequential retrieval by key.  (^) More Faster  (^) Inability to use duplicate keys  (^) No index Storage Space required  (^) Collision Occurrence  (^) Time Complexity is O(1)