Here Is Why HashSet Is So Fast in .NET

preview_player
Показать описание

In this video, we will implement custom hash table class, so to demonstrate the working principle behind .NET collections HashSet and Dictionary. We will also implement a custom GetHashCode on the string, demonstrating the techniques in mapping objects to integer numbers and explaining criteria that a good hashing function must comply with.
In the rest of the demo, we are implementing a custom class which combines hash codes of multiple data fields into one hash code, using modern techniques supported by .NET. At the very end of the video, you will learn about security measures taken in .NET to prevent hash flooding attacks.

Links:

Chapters:
00:00 Introducing hash tables
01:05 Implementing GetHashCode method on strings
06:08 The working principle of a hash table
09:02 Resolving collisions in the hash table
12:28 Implementing other methods a hash table exposes
17:40 Demonstrating the hash table in practice
19:31 Preparing a custom class for use in hash tables
21:49 Understanding the hash flooding attack vector

Learn more from video courses:

Other videos on this channel you may be interested in watching:
Рекомендации по теме
Комментарии
Автор

Thanks you very much. I recently failed an interview for a good position at a large corporation. I've had big problems with the HashSet topic and this motivated me to study the topic better. I'm happy that I found such a useful video.

IlyaBelozertsev
Автор

Hello!
First of all, thank you for this video! This is great!
At 5:10, I'm not sure how the math behind that works? By multiplying the base with hashCode itself, will it raise 31 to the power of the base? First time hashCode is 0, so that's correct, but the next value of hashCode depends on obj, so I'm not sure how that works. Thanks!

danstoian
Автор

On rehash your count is messed up because readding the items keeps increasing your property. Reset count before calling addrange to fix.

EvilDarkHawk
Автор

About the GetHashCode of strings - Some of the strings seems to have produced negative numbers. This is because the int overflows ?

tore
Автор

Hi Zoran Horvat you did well for explanation. as a entry level developer. suggest can u use little bit less technical words. i hard to get the meaning. ;)

Ram-hvxo
Автор

I tNice tutorialnk i'm gonna stick to gaming...

magicbhai
join shbcf.ru