Assuming threshold is inclusive and no rehash needed
Thinking table shrinks instead of grows
Believing insertion is rejected
4. A hash table implementation does not rehash when the load factor exceeds the threshold. What is the most likely problem caused by this?
medium
A. Insertions and lookups will become slower due to collisions
B. The table will automatically shrink in size
C. The table will run out of memory quickly
D. Elements will be deleted automatically to reduce load
Solution
Step 1: Understand effect of no rehashing at high load
Without rehashing, the table stays full, causing many collisions.
Step 2: Identify impact on operations
More collisions slow down insertions and lookups, matching Insertions and lookups will become slower due to collisions.
Final Answer:
Insertions and lookups will become slower due to collisions -> Option A
Quick Check:
No rehash -> more collisions -> slower operations [OK]
Hint: No rehash means slower operations from collisions [OK]
Common Mistakes:
Thinking memory runs out immediately
Assuming table shrinks automatically
Believing elements get deleted automatically
5. You have a hash table with capacity 16 and a load factor threshold of 0.75. After inserting 12 elements, you decide to rehash by doubling the capacity. What is the new load factor immediately after rehashing, before adding any new elements?