A hash function f defined as f(key) = key mod 7, with linear probing insert the keys 37, 38, 72, 48, 98, 11, 56, into a table indexed from 0, in which location the key 11 will be stored (Count table index 0 as 0th location)?
एक हैश फलन f को f(key) = key mod 7 के रूप में परिभाषित किया गया है, जो रैखिक प्रोबिंग के साथ कुंजी 37, 38, 72, 48, 98, 11, 56, इन्सर्ट करता है 11 से अनुक्रमित तालिका में कौन - सा स्थान में संग्रहीत किया जाएगा।
Explanation:
Insert 37:
37 mod 7 º 2 ;
37 Will be mapped to the 2nd bucket of hash table.

Insert 38:
38 mod 7 º 3
38 will be mapped to the 3rd bucket.

Insert 72:
72 mod 7 º 2
There will be 2 collisions (at bucket 2 and 3)
finally, 72 will be mapped to the 4th bucket.

Insert 48:
48 mod 7 = 6
48 will be mapped to the 6th bucket
Insert 98:
98 and 7 º 0
98 will be mapped to the 0th bucket.

Insert 11:
11 mod 7 º 4
But 4 is not empty so one collision occurs and 11 will be mapped to the 5th bucket.

Explanation:
Insert 37:
37 mod 7 º 2 ;
37 हैश तालिका की दूसरी बाल्टी में मैप किया जाएगा।

Insert 38:
38 mod 7 º 3
38 को तीसरी बकेट में मैप किया जाएगा।

Insert 72:
72 mod 7 º 2
2 टकराव होंगे (बाल्टी 2 और 3 पर)
अंत में, 72 को चौथी बाल्टी में मैप किया जाएगा।

Insert 48:
48 mod 7 = 6
48 को छठी बाल्टी में मैप किया जाएगा
Insert 98:
98 and 7 º 0
98 को 0वीं बकेट में मैप किया जाएगा।

Insert 11:
11 mod 7 º 4
लेकिन 4 खाली नहीं है इसलिए एक टक्कर होती है और 11 को 5वीं बाल्टी में मैप किया जाएगा।

Exam Preparation Simplified
Trusted by 8.1 Crore+ Students