The keys 5, 28, 19, 15, 26, 33, 12, 17, and 10 are inserted into a hash table using the hash function $h(k)=k \bmod 9$. Collisions are resolved by chaining. After all the keys are inserted, the length of the longest chain is __________. (answer in integer)
Using $h(k)=k \bmod 9$, the keys map as follows: $5\to5$, $28\to1$, $19\to1$, $15\to6$, $26\to8$, $33\to6$, $12\to3$, $17\to8$, and $10\to1$. Bucket 1 therefore contains 28, 19, and 10, giving a longest chain of length 3. Hence the answer is 3.
More Searching, Sorting and Hashing questions
GATE 2025 CS (CS1) Q33– The pseudocode of a function fun() is given below: Let A[0,...,29] be an array storing 30…
GATE 2025 CS (CS2) Q20– Consider an unordered list of N distinct integers. What is the minimum number of element…
GATE 2025 CS (CS2) Q41– An array A of length n with distinct elements is said to be bitonic if there is an index 1…
GATE 2023 CS Q20– An algorithm has to store several keys generated by an adversary in a hash table. The…
GATE 2022 CS Q16– Suppose we are given n keys, m hash table slots, and two simple uniform hash functions h 1…
GATE 2021 CS (CS1) Q19– Consider the following array: [23, 32, 45, 69, 72, 73, 89, 97]. Which algorithm out of the…