Question:medium

A hash function f defined as f(key) = key mod 7, with linear probing, is used to insert the keys 37, 38, 72, 48, 98, 11, 56 into a table indexed from 0 to 6. What will be the location of key 11?

Show Hint

Use modulo operation to compute the initial index, and handle collisions with linear probing by checking subsequent indices.
Updated On: Feb 11, 2026
  • 6
  • 2
  • 4
  • 0
Show Solution

The Correct Option is C

Solution and Explanation

Insertion sequence: 1. Key 37: 37 mod 7 = 2, placed at index 2. 2. Key 38: 38 mod 7 = 3, placed at index 3. 3. Key 72: 72 mod 7 = 2. A collision occurs, and linear probing assigns it to index 4. 4. Key 48: 48 mod 7 = 6, placed at index 6. 5. Key 98: 98 mod 7 = 0, placed at index 0. 6. Key 11: 11 mod 7 = 4. A collision occurs, and linear probing assigns it to index 5.
Was this answer helpful?
0