Recall & Review
beginner
What is collision in a hash table?
Collision happens when two different keys hash to the same index in the hash table.
Click to reveal answer
beginner
What does 'open addressing' mean in collision handling?
Open addressing means finding another empty spot in the hash table when a collision occurs, instead of using linked lists.
Click to reveal answer
beginner
How does linear probing work in open addressing?
Linear probing checks the next slot in the table one by one until it finds an empty slot to place the new key.
Click to reveal answer
intermediate
What problem can linear probing cause if many collisions happen?
Linear probing can cause clustering, where many keys group together, making search slower.
Click to reveal answer
beginner
In linear probing, how do you find a key during search?
Start at the hashed index and check slots one by one until you find the key or an empty slot (meaning key not present).
Click to reveal answer
What happens when a collision occurs in open addressing with linear probing?
✗ Incorrect
Linear probing inserts the key in the next available slot by checking slots one by one.
Which of these is a downside of linear probing?
✗ Incorrect
Linear probing can cause clustering, where many keys group together, slowing down operations.
How do you know a key is not in the hash table when searching with linear probing?
✗ Incorrect
Finding an empty slot during probing means the key was never inserted.
What is the first step in inserting a key using linear probing?
✗ Incorrect
You first hash the key to find the initial index to try inserting.
If the hashed index is occupied, what does linear probing do next?
✗ Incorrect
Linear probing checks the next index sequentially until it finds an empty slot.
Explain how collision handling works using open addressing with linear probing.
Think about what happens when two keys want the same spot and how linear probing finds a new spot.
You got /4 concepts.
Describe the main advantage and disadvantage of using linear probing for collision handling.
Consider memory use and performance impact.
You got /2 concepts.
