Computer Science Engineering (CSE) Exam  >  Computer Science Engineering (CSE) Questions  >  Consider a hash table of size 7, with hash fu... Start Learning for Free
Consider a hash table of size 7, with hash function H (k) = k % 7, and pseudo random i = (i + 5) % 7. We want to insert the following keys one by one from left to right.
15, 11, 25, 16, 9, 8, 12
What will be the position of the key 25, if we use random probing?
  • a)
    4
  • b)
    5
  • c)
    1
  • d)
    2
Correct answer is option 'D'. Can you explain this answer?
Most Upvoted Answer
Consider a hash table of size 7, with hash function H (k) = k % 7, and...
Hash Table with Random Probing
In random probing, we use a pseudo-random function to determine the next position to probe if a collision occurs during insertion. In this case, the pseudo-random function is i = (i + 5) % 7.

Inserting Keys
Let's insert the keys one by one according to the given order: 15, 11, 25, 16, 9, 8, 12.
- Insert 15: H(15) = 1. Key 15 is inserted at position 1.
- Insert 11: H(11) = 4. Key 11 is inserted at position 4.
- Insert 25: H(25) = 4. Since position 4 is already occupied by key 11, we use random probing i = (4 + 5) % 7 = 2. Key 25 is inserted at position 2.
- Insert 16: H(16) = 2. Key 16 is inserted at position 2.
- Insert 9: H(9) = 2. Since position 2 is already occupied by key 16, we use random probing i = (2 + 5) % 7 = 0. Key 9 is inserted at position 0.
- Insert 8: H(8) = 1. Since position 1 is already occupied by key 15, we use random probing i = (1 + 5) % 7 = 6. Key 8 is inserted at position 6.
- Insert 12: H(12) = 5. Key 12 is inserted at position 5.

Position of Key 25
After inserting all keys, the final positions are: 0, 1, 2, 4, 5, 6. Key 25 is at position 2, as determined by random probing. Therefore, the correct answer is option 'D' - 2.
Free Test
Community Answer
Consider a hash table of size 7, with hash function H (k) = k % 7, and...
Since we are using random probing:
Insert 15:

(15)%7 = 1
Insert 11:
(11)%7 = 4
Insert 25:
(25)%7 = 4 // collision:
i = 4
 i = (i + 5) % 7    // using random function
i = (4 + 5)%7 = 2
Hence 25 position is 2nd
Explore Courses for Computer Science Engineering (CSE) exam

Top Courses for Computer Science Engineering (CSE)

Question Description
Consider a hash table of size 7, with hash function H (k) = k % 7, and pseudo random i = (i + 5) % 7. We want to insert the following keys one by one from left to right.15, 11, 25, 16, 9, 8, 12What will be the position of the key 25, if we use random probing?a)4b)5c)1d)2Correct answer is option 'D'. Can you explain this answer? for Computer Science Engineering (CSE) 2026 is part of Computer Science Engineering (CSE) preparation. The Question and answers have been prepared according to the Computer Science Engineering (CSE) exam syllabus. Information about Consider a hash table of size 7, with hash function H (k) = k % 7, and pseudo random i = (i + 5) % 7. We want to insert the following keys one by one from left to right.15, 11, 25, 16, 9, 8, 12What will be the position of the key 25, if we use random probing?a)4b)5c)1d)2Correct answer is option 'D'. Can you explain this answer? covers all topics & solutions for Computer Science Engineering (CSE) 2026 Exam. Find important definitions, questions, meanings, examples, exercises and tests below for Consider a hash table of size 7, with hash function H (k) = k % 7, and pseudo random i = (i + 5) % 7. We want to insert the following keys one by one from left to right.15, 11, 25, 16, 9, 8, 12What will be the position of the key 25, if we use random probing?a)4b)5c)1d)2Correct answer is option 'D'. Can you explain this answer?.
Solutions for Consider a hash table of size 7, with hash function H (k) = k % 7, and pseudo random i = (i + 5) % 7. We want to insert the following keys one by one from left to right.15, 11, 25, 16, 9, 8, 12What will be the position of the key 25, if we use random probing?a)4b)5c)1d)2Correct answer is option 'D'. Can you explain this answer? in English & in Hindi are available as part of our courses for Computer Science Engineering (CSE). Download more important topics, notes, lectures and mock test series for Computer Science Engineering (CSE) Exam by signing up for free.
Here you can find the meaning of Consider a hash table of size 7, with hash function H (k) = k % 7, and pseudo random i = (i + 5) % 7. We want to insert the following keys one by one from left to right.15, 11, 25, 16, 9, 8, 12What will be the position of the key 25, if we use random probing?a)4b)5c)1d)2Correct answer is option 'D'. Can you explain this answer? defined & explained in the simplest way possible. Besides giving the explanation of Consider a hash table of size 7, with hash function H (k) = k % 7, and pseudo random i = (i + 5) % 7. We want to insert the following keys one by one from left to right.15, 11, 25, 16, 9, 8, 12What will be the position of the key 25, if we use random probing?a)4b)5c)1d)2Correct answer is option 'D'. Can you explain this answer?, a detailed solution for Consider a hash table of size 7, with hash function H (k) = k % 7, and pseudo random i = (i + 5) % 7. We want to insert the following keys one by one from left to right.15, 11, 25, 16, 9, 8, 12What will be the position of the key 25, if we use random probing?a)4b)5c)1d)2Correct answer is option 'D'. Can you explain this answer? has been provided alongside types of Consider a hash table of size 7, with hash function H (k) = k % 7, and pseudo random i = (i + 5) % 7. We want to insert the following keys one by one from left to right.15, 11, 25, 16, 9, 8, 12What will be the position of the key 25, if we use random probing?a)4b)5c)1d)2Correct answer is option 'D'. Can you explain this answer? theory, EduRev gives you an ample number of questions to practice Consider a hash table of size 7, with hash function H (k) = k % 7, and pseudo random i = (i + 5) % 7. We want to insert the following keys one by one from left to right.15, 11, 25, 16, 9, 8, 12What will be the position of the key 25, if we use random probing?a)4b)5c)1d)2Correct answer is option 'D'. Can you explain this answer? tests, examples and also practice Computer Science Engineering (CSE) tests.
Explore Courses for Computer Science Engineering (CSE) exam

Top Courses for Computer Science Engineering (CSE)

Explore Courses
Signup for Free!
Signup to see your scores go up within 7 days! Learn & Practice with 1000+ FREE Notes, Videos & Tests.
10M+ students study on EduRev