🧮Hash Table
Also known as Hash Map, Hashmap, Dictionary (Data Structure)
A store of keys and values. It finds a value by its key in one step.
Think of it like
Think of it like a coat check. Your ticket number says exactly which hook your coat is on.
Example
Emma's app keeps 2 million users in a hash table keyed by email. Finding one user takes the same time as finding one of 10.
Why it matters
It is the fastest common way to look things up by name. Caches, databases and counters all use one.
Definition
Common mistake
Key takeaways
- 1Keys and values. Find a value by its key.
- 2A hash picks the spot. Same key, same spot.
- 3O(1) on average. However many items.