Open Addressing — step by step
Explore insertion, lookup, and deletion using linear probing. Choose the exact operations and their order.
Setup
Step 1
Choose a sequence of operations, then step through the algorithm.
Operation sequence
The operations are performed from left to right. Green means completed; yellow marks the current operation.
Hash table
Never used / empty
Slot being checked
Occupied by another key
Inserted / found
Deleted (tombstone)
Hash calculation and probe sequence
Positions examined
No positions examined yet.
Use +k to insert key k, −k to delete it, and ?k to search for it. Separate operations with commas. Keys must be non-negative integers; table size can be 3–16.
A search may need to pass through a position where a key used to be. If deletion changed that position back to never used, a later search could stop there and incorrectly report that a key further along the probe sequence is absent.
A tombstone is therefore different from an empty slot: searches continue through it, while insertions may reuse it. When inserting into a tombstone, the algorithm continues probing until it can rule out an existing copy of the key.
Probe formula: pᵢ = (h(k) + i) mod m, where h(k) = k mod m and m is the table size.