Question discussion

A hash table uses the function h(k) = k mod 5 with separate chaining. The keys 12, 17, 22, 7, 3, 8 are inserted. What is the length of the…

1119Medium DSSSB TGT Computer Science 0 replies 1 views
0

A hash table uses the function h(k) = k mod 5 with separate chaining. The keys 12, 17, 22, 7, 3, 8 are inserted. What is the length of the longest chain?

  • A3
  • B5
  • C4
  • D6
Correct answer: C

Explanation

12, 17, 22 and 7 all hash to bucket 2 (4 keys), while 3 and 8 go to bucket 3, so the longest chain has 4 keys.

Discussion 0

Nobody has replied yet. Start the discussion!