Closed Hashing - (Linear Probing, Quadratic Probing & Double Hashing) | Collision Control
Автор: Simple Snippets
Загружено: 2023-08-02
Просмотров: 8566
In this video tutorial we will understand in detail what is Closed Hashing.
We will also study in detail the 3 different types of closed hashing(open adddressing) -
1. Linear Probing
2. Quadratic Probing
3. Double Hashing
In Open Addressing, all elements are stored in the hash table itself. So at any point, the size of the table must be greater than or equal to the total number of keys.
This entire procedure is based upon probing.
1) Linear Probing -
In linear probing, the hash table is searched sequentially that starts from the original location of the hash. If in case the location that we get is already occupied, then we check for the next location.
The function used for rehashing is as follows: rehash(key) = (n+1) % table-size.
2) Quadratic Probing (Mid-Square Method) -
In quadratic probing, the algorithm searches for slots in a more spaced-out manner. This is done to eliminate the drawback of clustering faced in linear probing. When a collision occurs, the algorithm looks for the next slot using an equation that involves the original hash value and a quadratic function. If that slot is also occupied, the algorithm increments the value of the quadratic function and tries again. This process is repeated until an empty slot is found.
3) Double Hashing -
In double hashing, we make use of two hash functions. The first hash function is h1(k), his function takes in our key and gives out a location on the hash-table. If the new location is empty, we can easily place our key in there without ever using the secondary hash function. However, in case of a collision, we need to use secondary hash-function h2(k) in combination with the first hash-function h1(k) to find a new location on the hash-table.
---------------------------------------------------------------------------------------------
Theory & Code article -
Full DSA playlist - • Introduction to Data Structures & Algorith...
Full C++ Programming for Beginners Course - • Introduction to Computer Programming & C++...
---------------------------------------------------------------------------------------------
Timecodes -
0:00 Intro & recap
0:54 Closed Hashing Introduction
3:04 Linear Probing with Example
15:00 Quadratic Probing with Example
23:05 Double Hashing with Example
30:00 Conclusion
---------------------------------------------------------------------------------------------
Support Simple Snippets by Donations -
Google Pay UPI ID - tanmaysakpal11@okicici
PayPal - paypal.me/tanmaysakpal11
---------------------------------------------------------------------------------------------
Simple Snippets Official Website -
http://simplesnippets.tech/
Simple Snippets on Facebook -
/ simplesnippets
Simple Snippets on Instagram -
/ simplesnippets
Simple Snippets on Twitter -
/ simplesnippet
Simple Snippets Google Plus Page -
https://plus.google.com/+SimpleSnippets
Simple Snippets email ID -
simplesnippetsinfo@gmail.com
For More Technology News, Latest Updates and Blog articles visit our Official Website - http://simplesnippets.tech/
#closedhashing #hashing #collisioncontrol #hashdatastructure
Доступные форматы для скачивания:
Скачать видео mp4
-
Информация по загрузке: