Recall & Review
beginner Click to reveal answer
What is collision in a hash table?
Collision happens when two different keys hash to the same index in the hash table.
beginner Click to reveal answer
How does chaining handle collisions in a hash table?
Chaining stores all elements that hash to the same index in a linked list or chain at that index.
beginner Click to reveal answer
What data structure is commonly used in chaining to store collided elements?
A linked list is commonly used to store collided elements at the same index.
intermediate Click to reveal answer
Why is chaining preferred over open addressing in some cases?
Chaining can handle more elements than the table size and is simpler to implement for collisions.
beginner Click to reveal answer
What happens when you search for a key in a hash table using chaining?
You go to the index from the hash function and then search through the linked list at that index to find the key.
What does chaining use to handle collisions?
✗ Incorrect
Chaining uses linked lists at each index to store multiple elements that hash to the same index.
If two keys hash to the same index, what does chaining do?
✗ Incorrect
Chaining stores both keys in a linked list at the same index to handle collisions.
Which of these is NOT true about chaining?
✗ Incorrect
Chaining does not require rehashing on collisions; it stores collided elements in a linked list.
What is the time complexity to search in a hash table using chaining in the worst case?
✗ Incorrect
In the worst case, all elements could be in one linked list, making search O(n).
Which of the following is a benefit of chaining?
✗ Incorrect
Chaining allows storing more elements than the table size by using linked lists at each index.
Explain how collision handling using chaining works in a hash table.
Think about what happens when two keys get the same index.
You got /4 concepts.
Describe the advantages and disadvantages of using chaining for collision handling.
Consider both space and time aspects.
You got /4 concepts.
