Algorithms and Data Structures · Junior · Question 14 of 75

What is the worst-case lookup time in a hash table?

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).

Further reading

Problem with a question

Algorithms and Data Structures · Junior · question 14

Test yourself

Take the Algorithms and Data Structures · Junior quiz: questions and options are shuffled, and you get a review of your mistakes at the end.

Take this quiz