Hash Map
A hash table storing key-value pairs; the key picks the bucket and the value travels with it.
Decision · step 2 of 12Hash Map: Filling buckets, with collisions
put 12 5: hash the key. 12 mod 5 = 2, so bucket 2 is the only place this key can be. It is empty.
What you will see
Key and value travel together into the bucket.
Cost
| put | O(1) expected |
|---|---|
| get | O(1) expected |
| remove | O(1) expected |
| Space | O(n) |
How you work with it here
play it through, step one change at a time, scrub to any step, run it on your own input, try operations in any order.
Screen readers: Each element is an accessibility element with position, value and state; structural changes are announced per step.
Reduced motion: Elements appear at their destination with a crossfade; no travel longer than the element's own size.
Before this
Leads to
Topics that need this one first.