Algorithms and Data Structures · Junior · Question 12 of 75

What is the main idea of a hash table?

Explanation

The hash function maps a key to a bucket index, so the value can be found without scanning all entries. That gives O(1) average time for insert, lookup and delete.

Further reading

Problem with a question

Algorithms and Data Structures · Junior · question 12

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