Hash Table Open Addressing Removals

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

WilliamFiset

WilliamFiset

Күн бұрын

Пікірлер: 27
@WilliamFiset-videos
@WilliamFiset-videos 6 жыл бұрын
For more context, a tombstone in the video really represents the key-value pair: (tombstone, null) where tombstone is some unique value/pointer.
@WilliamFiset-videos
@WilliamFiset-videos 6 жыл бұрын
As pointed out by @theSomething in the last example I should have replaced the key-value pair (k7, v7) with a tombstone instead of a null token.
@sahilsingh1
@sahilsingh1 10 ай бұрын
Can you please add this to the video description or in the pinned comment? Will be easier for people to find.
@DrunkJackal
@DrunkJackal 6 жыл бұрын
I just ran into this problem last night when I noticed my hash table was incorrect after removal. Thank you for this!
@MrMadplaya
@MrMadplaya 7 жыл бұрын
Really underrated for such well made videos. Pretty everything I needed on hashing, thanks.
@Wolfwuf
@Wolfwuf Жыл бұрын
For a second i thought i was listening to charlie (moistcritical) lol Thanks for the video, very concise and clear.
@thesomething8467
@thesomething8467 6 жыл бұрын
You can't just replace the old position with null. It might cause premature termination when looking up values
@WilliamFiset-videos
@WilliamFiset-videos 6 жыл бұрын
theSomething Can you elaborate? FYI I'm not allowing keys to be null.
@thesomething8467
@thesomething8467 6 жыл бұрын
In the last example. There could be a key with the same hash as k7 after k7
@WilliamFiset-videos
@WilliamFiset-videos 6 жыл бұрын
So something is definitely wrong. I believe I should have placed a tombstone instead of a null value, oops! Thanks for pointing this out.
@jonathanharoun5247
@jonathanharoun5247 4 жыл бұрын
@@WilliamFiset-videos What is a tombstone?
@bleachedrainbow
@bleachedrainbow 3 жыл бұрын
@@jonathanharoun5247 (for anyone new to this thread) A tombstone tells the retrieval function for the hash table that the index has been "previously used" so that it can continue looking for the key. Otherwise it will just assume that the key does not exist in the hash table.
@johanliebert5179
@johanliebert5179 6 жыл бұрын
awesome videos. i have never got bored watching your videos , excellent presentation.
@VidushJindal
@VidushJindal 6 ай бұрын
❤❤ such a lovely video, understood the concept clearly.
@alexanderyinyang1436
@alexanderyinyang1436 Жыл бұрын
I am confused with last part, where you replace first tombstone with k7,v7. With which logic do you find existing k7,v7 cell to replace with tombstone (to remove duplicate)?
@sofiamorais1366
@sofiamorais1366 2 ай бұрын
Thank you so much 🙏🙏
@ThanhNguyen-sl2kd
@ThanhNguyen-sl2kd 5 жыл бұрын
What if you insert (k3, v3) after remove k2 in the first example, it should be added after k1, but that would be a duplicate of k3
@Mydad-et1el
@Mydad-et1el 4 жыл бұрын
for the last problem, why do we need to keep track of all the tombstone? Don't we just need to know the first tombstone position only? As we will sub k7 into that first tombstone position. So wouldn't keeping track of the other position redundant?
@mohammadanvary9912
@mohammadanvary9912 3 жыл бұрын
Very clear and usefull. Thanks :)
@GauravKumar-sr6bt
@GauravKumar-sr6bt 2 жыл бұрын
When we relocated k7,v7 from index 7 to index 6, shouldn't we put tombstone at index 7, instead of null? My reasoning for this is that, suppose after inserting k7,v7, and before lookup of k7,v7, we inserted one more element (k8,v8) and it had to skip index 7 while probing because k7,v7 was present there. So after removing k7,v7, we again try to insert k8,v8, it will get inserted at index 7, even though it already exists.
@bob_jones
@bob_jones Жыл бұрын
Yep. theSomething mentioned this in a comment way earlier to which WilliamFiset responded and agreed.
@albertosposito1042
@albertosposito1042 Жыл бұрын
@@bob_jones But now i'm even more confused, if we replaced a tombstone with another tombstone, just in another position, isn't all of this work useless since it doesn't clear any space in our hash table?
@saniancreations
@saniancreations Жыл бұрын
@@albertosposito1042 The point of this optimization is not to remove tombstones, it is to make the lookup of elements with the same hash value faster. Before, it took 5 probes to look up the value. After the swap, it will only take 1. Swapping does not reduce the load factor but it does lower the average lookup time. It's like this: When that element was inserted, the table was a bit more cluttered and we had to place the value far away from its hash index, which makes the lookup take a bit longer. But now that a spot has opened up that is closer to the hash index, the next time we look up this value, we move it there which makes future lookups faster again.
@rohitsijwali8091
@rohitsijwali8091 4 жыл бұрын
How the tombstone contribute in load factor? When we remove an element and put a tombstone we can simply decrease number of elements. Is this because in this way we hit threshold earlier so resizetable will get rid of tombstone.
@mikhailpalagashvili169
@mikhailpalagashvili169 6 жыл бұрын
Excellent
@MrNukenin16
@MrNukenin16 3 жыл бұрын
5:33 voice crack
Hash table open addressing code
14:42
WilliamFiset
Рет қаралды 10 М.
Hash table open addressing
11:09
WilliamFiset
Рет қаралды 28 М.
The Ultimate Sausage Prank! Watch Their Reactions 😂🌭 #Unexpected
00:17
La La Life Shorts
Рет қаралды 8 МЛН
Noodles Eating Challenge, So Magical! So Much Fun#Funnyfamily #Partygames #Funny
00:33
БУ, ИСПУГАЛСЯ?? #shorts
00:22
Паша Осадчий
Рет қаралды 3 МЛН
Hash table hash function
17:21
WilliamFiset
Рет қаралды 44 М.
Hashes 8 Open Addressing
10:46
RobEdwards
Рет қаралды 31 М.
Faster than Rust and C++: the PERFECT hash table
33:52
strager
Рет қаралды 608 М.
Hash Tables and Hash Functions
13:56
Computer Science Lessons
Рет қаралды 1,6 МЛН
Why is Python 150X slower than C?
10:45
Mehul - Codedamn
Рет қаралды 20 М.
you will never ask about pointers again after watching this video
8:03
Hashing Technique - Simplified
17:04
Abdul Bari
Рет қаралды 775 М.
Hash table linear probing
13:56
WilliamFiset
Рет қаралды 43 М.
4. Hashing
52:55
MIT OpenCourseWare
Рет қаралды 340 М.
The Ultimate Sausage Prank! Watch Their Reactions 😂🌭 #Unexpected
00:17
La La Life Shorts
Рет қаралды 8 МЛН