Sir I have a doubt in mid square method in vedio u have taken 2 digit key so it is possible to delete right and left digit if it is single digit key how to solve ?
In Mid Square Method, first square is done then equal digits from left and right are discarded depending on set Hash function. In our example we set one digit remove from both sides and take the remaining. If 8 is number. Here 8 square will be 64. If one digit removed from both sides then nothing will remain which is wrong. So 0 will be applied before 64 which will be 064. Now discard one digit from both sides i.e. 0 & 4. Result is 6.
But sir if key is 8 and hash value is 6 then it means 8 will be store in the 6th position of the hash table but hash table size (N)is of is 3 becoz N is decided by the sum of no. Of keys and the first odd no. After the sum of no. Of keys here first odd no. After the value one is 3 therefore N is 3 and the key 8 hash value is 6 which is out of the size of the hash table
In folding method, first key is broken up into pieces (pieces size depends upon set hash function), then pieces are added and hash value is calculated using formula H(x) = (p1 + p2) mod m. Here p1 p2 are pieces and m is number of spaces available in hash table. For understanding assume hash value is like index of hash table. We are calculating hash value of key means we are calculating index where key will be stored in hash table. Let 89 is key and piece size is 1. Divide key 89 into 1 size pieces i.e. p1 = 8 and p2 = 9. Add pieces (p1 + p2) = 8 + 9 = 17. Let space available in hash table is 10, so m = 10 which means key can be stored in hash table from hash value (index) 0 to 9. Find hash value using formula H(x) = (p1 + p2) mod m = 17 mod 10 = 7. So key 89 will store in hash table at hash value (index) 7.
Collision Resolution Techniques are used to remove collision in Hashing. Refer Data Structure (DS) Playlist th-cam.com/play/PLU5x-SQTjZT7Byc8_BTdtMQkZ_7rjEUUm.html
In folding method, keys are partitioned into parts and parts are added together to find hash key. Here we will use formula, H(k) = (k1 + k2 + . . . + k3) mod m. Let m is 10. So for 1648, hash key will be (16 + 48) mod 10 = 64 mod 10 = 4. Note: There should be same formula for finding all hash keys.
Collision can also occur in Collision Resolution Techniques like Mid Square Method, Folding Method etc. and for that Double Hashing is used which is combination of two or more hashing techniques.
Hash Functions are used to calculate the Hash Value for the Key, so that Key can be stored in Hash Table. (Hash Value is like Index of Table. Keys are given Numbers which needs to be stored in Table. Hash Table is a Table which contain Hash Values and Keys.)
Thank you sir
Most Welcome 🙏
Thank you a lot Sir .
Your explanation is understandable for me and very helpful for me .❤
Most Welcome 🙏
very good teaching
Thank You
sir what if there is a 5 digit number in the folding method?
amazing teaching skills!!
Thank You 🙏
Great explanation. Thank you Sir!
Most Welcome 🙏
Tqq a lot sir.... 💛🙏🏻😌💯
Keep it up....💓
U r explanations way r jst awsm n short n quick
Most Welcome 🙏
Sir I have a doubt in mid square method in vedio u have taken 2 digit key so it is possible to delete right and left digit if it is single digit key how to solve ?
Bro for single digit consider the square of key as hash value
Sir in squaring method if there is 8 no. 8*8= 64
6 =| and 4=2 2÷2=| what we have to store in 1 means we have to store 8 or 64 in one plz reply
In Mid Square Method, first square is done then equal digits from left and right are discarded depending on set Hash function. In our example we set one digit remove from both sides and take the remaining. If 8 is number. Here 8 square will be 64. If one digit removed from both sides then nothing will remain which is wrong. So 0 will be applied before 64 which will be 064. Now discard one digit from both sides i.e. 0 & 4. Result is 6.
But sir if key is 8 and hash value is 6 then it means 8 will be store in the 6th position of the hash table but hash table size (N)is of is 3 becoz N is decided by the sum of no. Of keys and the first odd no. After the sum of no. Of keys here first odd no. After the value one is 3 therefore N is 3 and the key 8 hash value is 6 which is out of the size of the hash table
Extremely helpful
thank you
Thank You
mid-square method 6:49
Thanks
if 89 is also one of the key in folding method then by adding 8+9=17=7 will be the index.....then where do we store
In folding method, first key is broken up into pieces (pieces size depends upon set hash function), then pieces are added and hash value is calculated using formula H(x) = (p1 + p2) mod m. Here p1 p2 are pieces and m is number of spaces available in hash table.
For understanding assume hash value is like index of hash table. We are calculating hash value of key means we are calculating index where key will be stored in hash table.
Let 89 is key and piece size is 1. Divide key 89 into 1 size pieces i.e. p1 = 8 and p2 = 9. Add pieces (p1 + p2) = 8 + 9 = 17. Let space available in hash table is 10, so m = 10 which means key can be stored in hash table from hash value (index) 0 to 9. Find hash value using formula H(x) = (p1 + p2) mod m = 17 mod 10 = 7. So key 89 will store in hash table at hash value (index) 7.
Thank you
Most Welcome 🙏
What to split the square of 2345 which is 5499025
What if
Collision occurs in both folding and mid square method?
Collision Resolution Techniques are used to remove collision in Hashing.
Refer Data Structure (DS) Playlist
th-cam.com/play/PLU5x-SQTjZT7Byc8_BTdtMQkZ_7rjEUUm.html
How we do this four digits no 1648 by using folding method ??
In folding method, keys are partitioned into parts and parts are added together to find hash key.
Here we will use formula, H(k) = (k1 + k2 + . . . + k3) mod m. Let m is 10. So for 1648, hash key will be (16 + 48) mod 10 = 64 mod 10 = 4.
Note: There should be same formula for finding all hash keys.
helped!!
Thank You
Wt in case collision occured in mid square and folding method
Collision can also occur in Collision Resolution Techniques like Mid Square Method, Folding Method etc. and for that Double Hashing is used which is combination of two or more hashing techniques.
thanks
Most Welcome
Sir can i ask again whats the basic description of hash functions? Theres no subtitles so i cant really comprehend. Thank you sir
Hash Functions are used to calculate the Hash Value for the Key, so that Key can be stored in Hash Table.
(Hash Value is like Index of Table. Keys are given Numbers which needs to be stored in Table. Hash Table is a Table which contain Hash Values and Keys.)
Many points have been skipped in this video not recomennded
English thik kar lo sir aur accent thoda Indian rahega to bhi chalega
English is okay but accent should be indian