Skip to content
DSA Visualizerpreview

Hash table: separate chaining

Keys that collide share a bucket and line up in a chain.

O(1) average, O(n) if every key collides time · O(n + m) space

Keys15, 11, 27, 8, 12, 22, 4, 19size 7

A table of 7 buckets. Each key goes in bucket key mod 7.

bucket 0: empty; bucket 1: empty; bucket 2: empty; bucket 3: empty; bucket 4: empty; bucket 5: empty; bucket 6: empty.
  • compare
  • swap or write
  • settled

1 / 23

Speed

Space play · ← → step · Home End jump · drag the strip to scrub