Algorithms and Data Structures · Senior · Question 50 of 75

Which statement about average and worst case of hash table operations is correct?

Explanation

Expected O(1) relies on keys spreading evenly. Some implementations (Java 8 HashMap) turn long chains into trees, bounding the worst case at O(log n), but in general a hash table promises only average-case speed.

Further reading

Problem with a question

Algorithms and Data Structures · Senior · question 50

Test yourself

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

Take this quiz