Daily Quizzes
Mock Tests
Download MCQs Free PDF
Question
Computer Knowledge

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)?

3

4

5

6

एक हैश फलन f को f(key) = key mod 7 के रूप में परिभाषित किया गया है, जो रैखिक प्रोबिंग के साथ कुंजी 37, 38, 72, 48, 98, 11, 56, इन्सर्ट करता है 11 से अनुक्रमित तालिका में कौन - सा स्थान में संग्रहीत किया जाएगा।

3

4

5

6

View Answer & Solution
Correct Answer: C (5)
Detailed Solution:

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वीं बाल्टी में मैप किया जाएगा।

India’s #1 Learning Platform
Start Complete Exam Preparation
Daily Live MasterClasses
Practice Question Bank
Mock Tests & Quizzes
Trusted by 8.1 Crore+ Students

Exam Preparation Simplified

Learn Practice Analyse Improve
Get Started Free
Download the App

Trusted by 8.1 Crore+ Students

Enquire Now

Please share a few details to view the answer and solution.

Illustration of two people having a discussion

We're Here for You! Get in Touch with Class24 for All Your Needs!

Disclaimer: Your privacy is important to us. We will not share your information with third parties.