hash function | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

hash function

what is hash function, hash() ? how can it be used?

20th Dec 2017, 5:32 PM
Tanya Fitkiriwala
Tanya Fitkiriwala - avatar
1 Answer
0
Think in hash like a (my english is not very well jajaj) machine to make juice with fruits revolving all... (idk what's the algorithm to get the hash) you'll get an unique (almost, not always) value for any thing (even pictures, audios, etc). Dictionaries use hash to "order" them elements (for that reason dictionaries print unsorted). If you ask for a value in them, the key you passed is hashed and the dictionary matches this value with their keys, finding exactly where the key is. This search method is so fast, the steps to find a value is just 1, not like a linear searching when you are analyzing value per value until to find a coincidence. Please if any other sees I said something bad correct me.
20th Dec 2017, 5:43 PM
Sebastián Zapata
Sebastián Zapata - avatar