engineering recuitment NIC NIELIT Scientist B 2023 Mock Test Algorithms Searching, Sorting and Hashing Searching
A hash table of length (n) 5 uses hashing to insert a value (k) and linear probing to resolve the collision. After inserting 4, 25, 83, 77, 40 into an empty hash table, the table is as shown below.
|
Index |
Key |
|
0 |
4 |
|
1 |
25 |
|
2 |
40 |
|
3 |
77 |
|
4 |
83 |
Which one of the following hash function will distribute elements as shown in the above hash table?
1
K mod (n – 1)
2
(K – 1) mod n
3
K mod (n + 1)
4
(K + 1) mod n