Recall & Review
beginner
What is the load factor in a hash table?
Load factor is the ratio of the number of stored elements to the total number of slots in the hash table. It shows how full the table is.
Click to reveal answer
beginner
Why is load factor important in hash tables?
Load factor helps decide when to resize the hash table. A high load factor means more collisions, which slows down operations.
Click to reveal answer
beginner
What does rehashing mean?
Rehashing means creating a new larger hash table and moving all existing elements into it using a new hash function or table size.
Click to reveal answer
intermediate
When should rehashing be done?
Rehashing is done when the load factor exceeds a certain threshold, usually around 0.7 or 70%, to keep operations fast.
Click to reveal answer
intermediate
What is the effect of rehashing on hash table performance?
Rehashing reduces collisions by increasing table size, which improves search, insert, and delete speeds but temporarily costs time to move elements.
Click to reveal answer
What does a load factor of 1 mean in a hash table?
✗ Incorrect
A load factor of 1 means the number of elements equals the number of slots, so the table is full.
Why do we rehash a hash table?
✗ Incorrect
Rehashing increases the table size to reduce collisions and improve performance.
Which load factor value usually triggers rehashing?
✗ Incorrect
A load factor around 0.7 is a common threshold to trigger rehashing.
What happens during rehashing?
✗ Incorrect
Rehashing moves elements to a larger table to reduce collisions.
What is a downside of rehashing?
✗ Incorrect
Rehashing takes time to move elements, causing a temporary slowdown.
Explain what load factor is and why it matters in hash tables.
Think about how full the table is and how that affects speed.
You got /3 concepts.
Describe the process and purpose of rehashing in hash tables.
Consider what happens when the table gets too full.
You got /3 concepts.