Separate Chaining
Each bucket holds a chain of colliding entries; a lookup hashes once and compares keys along that chain.
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
A collision appends a node to the bucket's chain.
Cost
| insert | O(1) |
|---|---|
| search | O(1 + load factor) expected |
| Space | O(n + buckets) |
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.