Computer Science Engineering (CSE) Exam  >  Computer Science Engineering (CSE) Questions  >  Consider a hashing function that resolves col... Start Learning for Free
Consider a hashing function that resolves collision by quadratic probing. Assume the address space is indexed from 1 to 8. Which of the following locations will never be probed if a collision occurs at position 4?
  • a)
    4
  • b)
    5
  • c)
    8
  • d)
    2
Correct answer is option 'D'. Can you explain this answer?
Verified Answer
Consider a hashing function that resolves collision by quadratic probi...
You can verify that the 1st, 3rd, 5th, 7th...probes check at location 5.
The 2nd, 6th, 10th...probes check at location 8. The 4th, 8th, 12th...probes check at location 4. The rest of the address space, will never be probed.
View all questions of this test
Most Upvoted Answer
Consider a hashing function that resolves collision by quadratic probi...
Solution:

Hashing function:

A hashing function is a function that maps input data of arbitrary size to a fixed size output. In other words, it takes an input value and returns an index value to the corresponding array.

Quadratic probing:

Quadratic probing is a method of resolving collisions in a hash table. When a collision occurs, instead of simply moving to the next available slot, the algorithm uses a quadratic function to determine the next available slot.

Address space:

The address space is the range of addresses that a computer can access.

Given:

The address space is indexed from 1 to 8.

Collision occurs at position 4.

We need to find which location will never be probed.

Solution:

We can use the following formula to calculate the next probe position in quadratic probing:

next_probe = (current_position + i^2) % table_size

where i is the number of probes made so far.

Let's assume that the hash function returns index 4 for a key. Now, if a collision occurs at position 4, we need to find the next probe positions using quadratic probing.

First probe:

next_probe = (4 + 1^2) % 8 = 5

The first probe position is 5.

Second probe:

next_probe = (4 + 2^2) % 8 = 0

The second probe position is 0. But 0 is not a valid index in our address space.

Third probe:

next_probe = (4 + 3^2) % 8 = 5

The third probe position is 5, which is the same as the first probe position. This means that we will end up in an infinite loop.

Therefore, the location that will never be probed is 2.

Conclusion:

The correct answer is option 'D', which is 2. When a collision occurs at position 4, location 2 will never be probed using quadratic probing.
Explore Courses for Computer Science Engineering (CSE) exam

Similar Computer Science Engineering (CSE) Doubts

Top Courses for Computer Science Engineering (CSE)

Consider a hashing function that resolves collision by quadratic probing. Assume the address space is indexed from 1 to 8. Which of the following locations will never be probed if a collision occurs at position 4?a)4b)5c)8d)2Correct answer is option 'D'. Can you explain this answer?
Question Description
Consider a hashing function that resolves collision by quadratic probing. Assume the address space is indexed from 1 to 8. Which of the following locations will never be probed if a collision occurs at position 4?a)4b)5c)8d)2Correct answer is option 'D'. Can you explain this answer? for Computer Science Engineering (CSE) 2024 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 hashing function that resolves collision by quadratic probing. Assume the address space is indexed from 1 to 8. Which of the following locations will never be probed if a collision occurs at position 4?a)4b)5c)8d)2Correct answer is option 'D'. Can you explain this answer? covers all topics & solutions for Computer Science Engineering (CSE) 2024 Exam. Find important definitions, questions, meanings, examples, exercises and tests below for Consider a hashing function that resolves collision by quadratic probing. Assume the address space is indexed from 1 to 8. Which of the following locations will never be probed if a collision occurs at position 4?a)4b)5c)8d)2Correct answer is option 'D'. Can you explain this answer?.
Solutions for Consider a hashing function that resolves collision by quadratic probing. Assume the address space is indexed from 1 to 8. Which of the following locations will never be probed if a collision occurs at position 4?a)4b)5c)8d)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 hashing function that resolves collision by quadratic probing. Assume the address space is indexed from 1 to 8. Which of the following locations will never be probed if a collision occurs at position 4?a)4b)5c)8d)2Correct answer is option 'D'. Can you explain this answer? defined & explained in the simplest way possible. Besides giving the explanation of Consider a hashing function that resolves collision by quadratic probing. Assume the address space is indexed from 1 to 8. Which of the following locations will never be probed if a collision occurs at position 4?a)4b)5c)8d)2Correct answer is option 'D'. Can you explain this answer?, a detailed solution for Consider a hashing function that resolves collision by quadratic probing. Assume the address space is indexed from 1 to 8. Which of the following locations will never be probed if a collision occurs at position 4?a)4b)5c)8d)2Correct answer is option 'D'. Can you explain this answer? has been provided alongside types of Consider a hashing function that resolves collision by quadratic probing. Assume the address space is indexed from 1 to 8. Which of the following locations will never be probed if a collision occurs at position 4?a)4b)5c)8d)2Correct answer is option 'D'. Can you explain this answer? theory, EduRev gives you an ample number of questions to practice Consider a hashing function that resolves collision by quadratic probing. Assume the address space is indexed from 1 to 8. Which of the following locations will never be probed if a collision occurs at position 4?a)4b)5c)8d)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