Good Hash Function - (Even Distribution | Easy Computation) Hashing
HTML-код
- Опубликовано: 24 июл 2024
- This video lecture is produced by S. Saurabh. He is B.Tech from IIT and MS from USA.
In this lecture you will learn about how to design good hash function.
What are the qualities of good hash function
It should be evenly distributed
It should be easy to compute
To study interview questions on Linked List watch • Programming Interviews...
To prepare for programming Interview Questions on Binary Trees
• Programming Interviews...
To study programming Interview questions on Stack, Queues, Arrays visit
• Programming Interviews...
To watch all Programming Interview Questions visit
• Programming Interviews...
To learn about Pointers in C visit
• Pointers in C (All you...
To learn C programming from IITian S.Saurabh visit
• C Programming Tutorial
Your explanation for second hash function u used i.e sigma(key[i]).27^imod1000 is not justified
Thank you so much it was really helpful to study!!
great explanation!
Thanks!
it says easy but i don't understand anything still better explanation than my teacher
best vid ever!
HI Saurabh, Thanks for the excellent work!!
I have a query on how you arrived at the numbers 27 in 2nd case and 32 in 3rd case.
I know we prefer prime numbers to have maximum possible distribution but would like to hear your thoughts on why 27 and 32?
Thanks!
+Sudheer Kumar Puzzled at how he came up with these numbers too. Would appreciate some explanation
+Diksha +saurabhschool can you tell us how you arrived at these numbers?
+Sudheer Kumar 32 here probably means the word size of a machine in bits
what is the value of "key" inside key[key-size-i]*32^i
Thanks a lot!
where did you get 10007? it's so random
Please be clear and specific with your choice of words
Can you calculate the original key from its hash value? Good lecture by the way.
no obv not, thats the definition of a hashfunction. altough in some cases its possible but for that youd need cipher block chaining and a padding oracle....
ah nvm 7 years ago lol
Why we say hash function takes o(1) time in searching any Key, in my opinion it should be o(Lambda) where lambda is a load factor ?
yes, O(1) is said only when we assume there is no collision, other wise it will be O(lambda)
saurabhschool
Hello Saurabh, i have doubt, Let us suppose that there is NO Collision at all , even then how could the time is o(1) , is it not o(n) because Algo has to compare keys with all the keys in the cells in order to get which Key matched correctly.
O(1) Means constant time, but as you increase the number of elements to put in the HastTable, you have to increase the size of the table also, which means it is linearly related to the input size and hence o(n).
Sahil Rally The hashtables uses a data structure called "Arrays", Arrays uses a prefixed amount of space in memory(as opposed to Lists), thus through 'direct access'(a function in memory) you are able to access a given and predefined position in memory for a given array index in O(1) time. Hope that made it more clear :)
Gunnar Nielsen Thanks !!! Appreciate!!!
I is very good...........
Yaar kitni baar 'Ok' bolega. Aisa lag raha hai okay's ke beech mein thoda bohot padha dia
You say that mod 10 is not a good hashfunct. because it hasn't a even distribution for the numbers 10,20,1000,10000... and than you say mod 7 is better because the distribution is even for 10,20..... ?! But if you use 7,14,21... mod 7 is very bad too!! So I didn't understand what is better with mod 7 then 10
He means with regard to this data sample, using mod 7 is a better choice than mod 10. That's what's about choosing an appropriate hash function which meets the need of the current data
byłem w manche# ze 3 razy angielski słabo umiem ale lektor jak chuj pakol!
Are you seriously an IITian? I doubt
quite good videos ..knowledge is also wide f urself but plzzz correct ur accent ..thats too muchh irritating
if accent bothers u .. u r a effing frog in a well.. get over it ppl from around the globe have different accent of eng. u dont understand it can be acceptable n u can watch someone else if its just irritating u, u r a narrow minded person
Divya Sasidharan well said
u r not able to explain in that good manner!!!!
disappointment