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
@beegyoshi92922 жыл бұрын
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 Жыл бұрын
You want to miss empty slots. You don't want clumping, like he says at the beginning.
@kevinjosueraymundogarcia30294 жыл бұрын
Well explained video, thank you!
@johnmartin92943 жыл бұрын
Pro tip : watch movies on KaldroStream. I've been using it for watching loads of movies these days.
@coltenbraxton43263 жыл бұрын
@John Martin Definitely, I have been watching on kaldrostream for years myself =)
@bridgerhouston41313 жыл бұрын
@John Martin Yup, I have been watching on kaldrostream for years myself :)
@leroylevi74323 жыл бұрын
@John Martin yup, I've been watching on kaldroStream for years myself =)
@isaacdouglas11193 жыл бұрын
Is the h1(k) supposed to be h1(x)?
@niemasd3 жыл бұрын
Woops, thanks, good catch! Yes it is
@yesyas59726 ай бұрын
All clear, thanks
@channelname94683 ай бұрын
why talk about linear probing in a video about double hashing
@pawmeowzing29063 жыл бұрын
what if after double hash there is collision too??
@niemasd3 жыл бұрын
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
@pawmeowzing29063 жыл бұрын
@@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 Жыл бұрын
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 Жыл бұрын
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 Жыл бұрын
@@niemasd gotcha, I misunderstood for h(x) definition
@bwbs7410 Жыл бұрын
you spent half the video talking about linear probing in a video titled double probing smh