Question 3888 – Data-Structures
November 23, 2023Question 7132 – NVS PGT CS 2019 Part-A
November 23, 2023Question 3889 – Data-Structures
Suppose we are implementing quadratic probing with a Hash function, Hash(y)=X mod 100. If an element with key 4594 is inserted and the first three locations attempted are already occupied, then the next cell that will be tried is :
Correct Answer: B
Question 418 Explanation:
Given quadratic probing with a Hash function,
— Hash(y)=X mod 100
— Key=4594
— First 3 locations are already occupied.
— Next cell=?
Step-1: Quadratic Probing function is h(k,i) = (h'(k) +c 1 i+c 2 i 2 )mod m 0≤ i ≤ m-1
where c1 and c2 constants ≠0
Step-2: First pass: 4594 % 100
= 94
Sep-3: Second pass: (4594 + 1 2 ) % 100
= (94 + 1) % 100
= 95
Step-3: Third pass: (4594 + 2 2 ) % 100
= (94 + 4) %100
= 98
Step-4: Fourth pass: (4594 + 1 2 ) % 100
= (94 + 9) %100
= 103 % 100
= 3
— Hash(y)=X mod 100
— Key=4594
— First 3 locations are already occupied.
— Next cell=?
Step-1: Quadratic Probing function is h(k,i) = (h'(k) +c 1 i+c 2 i 2 )mod m 0≤ i ≤ m-1
where c1 and c2 constants ≠0
Step-2: First pass: 4594 % 100
= 94
Sep-3: Second pass: (4594 + 1 2 ) % 100
= (94 + 1) % 100
= 95
Step-3: Third pass: (4594 + 2 2 ) % 100
= (94 + 4) %100
= 98
Step-4: Fourth pass: (4594 + 1 2 ) % 100
= (94 + 9) %100
= 103 % 100
= 3
2
3
9
97
Subscribe
Login
0 Comments