|
|
|
|
|
by certeoun
1769 days ago
|
|
If you are proficient in C, maybe his videos might help you: https://www.youtube.com/user/mycodeschool/videos General tips: If you are implementing a hash table (std::unordered_map) via open addressing: you cannot simply delete "buckets" or entries out of a hash table. Why? Because you "break" the search chain. The solution is to have a flag or something for each bucket. FULL|"I stored this here"|EMPTY|nullptr|DEAD|"I am invalid now :("|... You have 3 states. When searching or deleting, you preserve the "search chain" that way. "FULL" and "DEAD" means you can iterate over or delete when on a search or delete op. "EMPTY" on an add operation means, okay here it is, here I can place something.
If you use chaining instead of open addressing you don't have to worry about "breaking the search chain". |
|