How to handle Hash Table Collisions using Linear Probing

preview_player
Показать описание

Please check my playlists for free DSA problem solutions:

Best Courses for Analytics:
---------------------------------------------------------------------------------------------------------

Best Courses for Programming:
---------------------------------------------------------------------------------------------------------

Best Courses for Machine Learning:
---------------------------------------------------------------------------------------------------------

Best Courses for Statistics:
---------------------------------------------------------------------------------------------------------

Best Courses for Big Data:
---------------------------------------------------------------------------------------------------------

More Courses:
---------------------------------------------------------------------------------------------------------

Full Disclosure:
Please note that I may earn a commission for purchases made at the above sites! I strongly believe in the material provided; I only recommend what I truly think is great. If you do choose to make purchases through these links; thank you for supporting the channel, it helps me make more free content like this!
Рекомендации по теме
Комментарии
Автор

Master Data Structures & Algorithms For FREE at AlgoMap.io!

GregHogg
Автор

If the size of Hash Table is smaller, it’s easy to hit the collision. Finding the spot to persist the <K, V> would take O(n), Searching it to get the entry would also take O(n). However, the library in programming languages generally should get a good size of hash table to avoid the collision. That is why you will get O(1) to retrieve the entry. You also can generate your own hash code for purpose. Happy coding!

rjamesdoe
Автор

Thank you! This video helps me brush up the knowledge of the linear probing to solve collisions.

rjamesdoe
Автор

As I understand it, if index 4 was occupied as well it would pick index 0, and when there was no empty spaces it would loop through the entire list to look for a value that isn't there, sound very complicated to me with lots of traps

casper_hansen
Автор

So, would this have a worst case search of O(N) ?

blazingwarlord
Автор

how would it know that grg != greg when it looks it up?

cla
Автор

I don't know where you get this algo... it could have any sense only in some ancient hardware realisation of pages addres translation. In most uses in programing this algo is crap. It have nice local property which is nice to cache and no new allocation (still smells hardware or embedded)but still i see only few niches where it could have benefit.

AK-vxdy
Автор

Why not move grg back to the correct position after deleting the value? We would probably need to store the hash or maybe hash all the characters in the array until you find a value that has hash equal to that of the value you just deleted.

syedmuhammadsameer
Автор

ho the f....actually write that low lvl code at work? just use the hashtable provided by the language or a library

christianrazvan
join shbcf.ru