AlgoPlus//structures / hashing
Read the theory

Hash Table

Keys hash to buckets; collisions chain — average O(1) lookup.

Buckets
5
Keys
0
Load factor
0.00
Legend
Hashed bucket / probe
Found
Stored key
AI Tutor Workspace
In a nutshell
A hash table finds things almost instantly by computing where they live instead of searching. A hash function turns each key into a bucket number, so to store or look up a key you jump straight to that bucket. Sometimes two keys land in the same bucket — a collision — and those are kept together in a small chain. As long as collisions stay rare, lookups are effectively constant time, which is why hash tables back dictionaries and sets everywhere.
Ready
Press play to begin the cinematic walkthrough.
A hash function turns a key into a bucket index, so lookups jump straight to the right place. Collisions (two keys, one bucket) are handled by chaining them in a list.
Key terms
Go deeper in the lesson
Read the full theory, intuition & complexity for Hash Table.