Algorithms and Data Structures · Junior · Question 14 of 75
What is the worst-case lookup time in a hash table?
1O(log n)
2O(1)
✓Correct answer: O(n)
Explanation
If many keys collide into the same bucket, a lookup has to check them one by one. Good hash functions and resizing make this extremely rare, so the average stays O(1).