Advanced Data Structures: Double Hashing

  Рет қаралды 25,092

Niema Moshiri

Niema Moshiri

Күн бұрын

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

Пікірлер: 23
@MaliaCamille
@MaliaCamille 2 жыл бұрын
Video starts @ 5:30
@reddistone
@reddistone Жыл бұрын
What does this have to do with double hashing?
@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
@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.
@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 =)
@isaacdouglas1119
@isaacdouglas1119 3 жыл бұрын
Is the h1(k) supposed to be h1(x)?
@niemasd
@niemasd 3 жыл бұрын
Woops, thanks, good catch! Yes it is
@yesyas5972
@yesyas5972 6 ай бұрын
All clear, thanks
@channelname9468
@channelname9468 3 ай бұрын
why talk about linear probing in a video about double hashing
@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 Жыл бұрын
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 Жыл бұрын
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 Жыл бұрын
@@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
Advanced Data Structures: Closed Addressing (Separate Chaining)
10:16
Advanced Data Structures: Open Addressing (Linear Probing)
10:52
Niema Moshiri
Рет қаралды 14 М.
Epic Reflex Game vs MrBeast Crew 🙈😱
00:32
Celine Dept
Рет қаралды 33 МЛН
Advanced Data Structures: Aho-Corasick Automaton
9:55
Niema Moshiri
Рет қаралды 59 М.
8.3 Double Hashing | Collision Resolution Technique | Data Structures and algorithms
26:52
Bresenham's Line Algorithm - Demystified Step by Step
16:10
NoBS Code
Рет қаралды 55 М.
Hash Tables and Hash Functions
13:56
Computer Science Lessons
Рет қаралды 1,6 МЛН
Advanced Data Structures: Count-Min Sketches
7:19
Niema Moshiri
Рет қаралды 27 М.
SHA: Secure Hashing Algorithm - Computerphile
10:21
Computerphile
Рет қаралды 1,2 МЛН
Advanced Data Structures: Suffix Array Search
12:33
Niema Moshiri
Рет қаралды 15 М.
Faster than Rust and C++: the PERFECT hash table
33:52
strager
Рет қаралды 580 М.
Hashing Technique - Simplified
17:04
Abdul Bari
Рет қаралды 761 М.
Query, Key and Value Matrix for Attention Mechanisms in Large Language Models
18:21