Consider a hash table that is initially empty. The hash table is maintained using open addressing with linear probing. The hash function used is .
Consider the following sequence of insertions performed on :
Which of the following positions in the hash table is/are empty after these insertions are performed?
View worked solution
Answer: C
We are given a hash table of size . The hash function is , and collisions are resolved using linear probing.
Let's trace the insertions step-by-step:
- Insert 1:
.
Position is empty. Insert at . - Insert 13:
.
Position is empty. Insert at . - Insert 22:
.
Position is empty. Insert at . - Insert 15:
.
Position is empty. Insert at . - Insert 11:
.
Position is occupied. Probing sequentially:
- Index is occupied.
- Index is occupied.
- Index is empty. Insert at . - Insert 24:
.
Position is occupied. Probing sequentially:
- Index is occupied.
- Index is occupied.
- Index is empty. Insert at .
After all insertions, the occupied positions in the hash table are:
The empty positions are and . Among the given options, only position (Option C) is empty.
Free practice · Your answers on this page are not saved.
