Consider a hash table of size 10 with indices {0, 1,..., 9}, with the hash function
h(x) = 3x (mod 10),
where linear probing is used to handle collisions. The hash table is initially empty and then the following sequence of keys is inserted into the hash table: 1, 4, 5, 6, 14, 15. The indices where the keys 14 and 15 are stored are, respectively
2 and 5
2 and 6
4 and 5
4 and 6
We are given:
Hash table size: 10
Hash function: h(x) = (3x) mod 10
Collision resolution: Linear Probing
Keys inserted in order: 1, 4, 5, 6, 14, 15
🔍 Step-by-step Insertion:
🔹 Insert 1:
Index 3 is free → insert at index 3
🔹 Insert 4:
Index 2 is free → insert at index 2
🔹 Insert 5:
Index 5 is free → insert at index 5
🔹 Insert 6:
Index 8 is free → insert at index 8
🔹 Insert 14:
Index 2 → occupied (by 4)
Linear probing → try index 3 → occupied (by 1)
Try index 4 → free → insert at index 4
🔹 Insert 15:
Index 5 → occupied (by 5)
Try index 6 → free → insert at index 6
✅ Final answer:
14 → index 4, 15 → index 6
Correct option: (D) 4 and 6