Тёмный

Advanced Data Structures: Double Hashing 

Niema Moshiri
Подписаться 5 тыс.
Просмотров 25 тыс.
50% 1

CORRECTIONS/NOTES:
* 6:46: h_1(k) should be h_1(x)

Опубликовано:

 

26 сен 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 23   
@MaliaCamille
@MaliaCamille 2 года назад
Video starts @ 5:30
@reddistone
@reddistone Год назад
What does this have to do with double hashing?
@channelname9468
@channelname9468 3 месяца назад
why talk about linear probing in a video about double hashing
@isaacdouglas1119
@isaacdouglas1119 3 года назад
Is the h1(k) supposed to be h1(x)?
@niemasd
@niemasd 3 года назад
Woops, thanks, good catch! Yes it is
@kevinjosueraymundogarcia3029
@kevinjosueraymundogarcia3029 4 года назад
Well explained video, thank you!
@johnmartin9294
@johnmartin9294 3 года назад
Pro tip : watch movies on KaldroStream. I've been using it for watching loads of movies these days.
@coltenbraxton4326
@coltenbraxton4326 3 года назад
@John Martin Definitely, I have been watching on kaldrostream for years myself =)
@bridgerhouston4131
@bridgerhouston4131 3 года назад
@John Martin Yup, I have been watching on kaldrostream for years myself :)
@leroylevi7432
@leroylevi7432 3 года назад
@John Martin yup, I've been watching on kaldroStream for years myself =)
@hhh1656
@hhh1656 3 года назад
If we use digit floding method as hash function,then hash key for 70 is 7(7+0).where we have to insert key 70 as the table size Is 5
@yesyas5972
@yesyas5972 6 месяцев назад
All clear, thanks
@beegyoshi9292
@beegyoshi9292 2 года назад
Wouldn't you want your second hash function to always output a number coprime to the length of the table for this to work? Otherwise you end up wasting space as when doing the "probing" step you could easily miss empty slots.
@yunoletmehaveaname
@yunoletmehaveaname Год назад
You want to miss empty slots. You don't want clumping, like he says at the beginning.
@pawmeowzing2906
@pawmeowzing2906 3 года назад
what if after double hash there is collision too??
@niemasd
@niemasd 3 года назад
You keep probing just as you would with Linear Probing. The only distinction between Double Hashing and Linear Probing is that, in Linear Probing, if you have a collision, you keep probing 1 slot over at a time until you find an open slot, whereas in Double Hashing, if you have a collision, you keep probing h2(k) slots over at a time until you find an open slot
@pawmeowzing2906
@pawmeowzing2906 3 года назад
@@niemasd the question now is how about if we want to find back the key? Say first round it didn't find it, then how do it knows when to stop probing when searching?
@jacobtrombley7650
@jacobtrombley7650 11 месяцев назад
You gave hash_function1(x) = x%5. Therefore, your hash_function2(x) = 1 + (hash_function1(x)/m)%(m-1) for 70 would be hash_function2(x) = 1 + ((x%5)/m)%(m-1) = 1 + ((70%5)/5)%(5-1) = 1 + (0/5)%4 = 1. Therefore, your hash_function2 is giving a different value than the one you computed (1 instead of 3). Maybe you meant hash_function2(x) = 1 + (x/m)%(m-1)? This would give you 1 + (70/5)%(5-1) = 1 + 14%4 = 3.
@niemasd
@niemasd 11 месяцев назад
h(x) = x, not x%5. The %5 comes from converting the hash value (x) into a valid index in the array (which has a length of 5)
@jacobtrombley7650
@jacobtrombley7650 11 месяцев назад
@@niemasd gotcha, I misunderstood for h(x) definition
@bwbs7410
@bwbs7410 Год назад
you spent half the video talking about linear probing in a video titled double probing smh