Q.A hash table of length 10 uses open addressing with hash function h(k) = kmod 10 and linear probing. After inserting 6 values into an empty hash table, the table is shown below: 0 1 2 42 3 23 4 34 5 52 6 46 7 33 8 9 Which of the following choices gives a possible order in which the key values could have been inserted in the table?
Correct answer: 46, 34, 42, 23, 52, 33
Explanation
The question involves a has table of length 10 using open addressing and linear probing with the hash function h(k) = kmod 10. We need to determine the correct sequence of insertion based on the given table. Option (c) : 46, 34, 42, 23, 52, 33 • Insert 46 → 46 mod 10 = 6 placed at index 6. • Insert 34 → 34 mod 10 = 4 placed at index 4. • Insert 42 → 42 mod 10 = 2 placed at index 2. • Insert 23 → 23 mod 10 = 3 placed at index 3. • Insert 52 → 52 mod 10 = 2 collision → next available index is 5. • Insert 33 → 33 mod 10 = 3 collision → next available index is 7. Matches the given table, So the possible orders of insertion is 46, 34, 42, 23, 52, 33.
The question involves a has table of length 10 using open addressing and linear probing with the hash function h(k) = kmod 10. We need to determine the correct sequence of insertion based on the given table. Option (c) : 46, 34, 42, 23, 52, 33 • Insert 46 → 46 mod 10 = 6 placed at index 6. • Insert 34 → 34 mod 10 = 4 placed at index 4. • Insert 42 → 42 mod 10 = 2 placed at index 2. • Insert 23 → 23 mod 10 = 3 placed at index 3. • Insert 52 → 52 mod 10 = 2 collision → next available index is 5. • Insert 33 → 33 mod 10 = 3 collision → next available index is 7. Matches the given table, So the possible orders of insertion is 46, 34, 42, 23, 52, 33.