The one core idea: an open-addressing hash table stores keys directly inside one array, and to find a key you walk a fixed trail of slots until you hit it or hit an EMPTY slot that says "stop, not here." Deleting a key by blanking its slot to EMPTY lies to that trail — so we instead plant a tombstone that means "gone, but keep walking."
This page builds every word and symbol the parent note leans on, from absolutely nothing. If you have never seen a hash table, start here and read top to bottom — nothing below is used before it is drawn.
Before any hashing, you need the picture of an array : a straight row of numbered boxes, side by side, each holding one thing.
Definition Array and its index
An array is a fixed row of boxes. Each box has an address called its index , counted from 0 . So the first box is index 0 , the second is index 1 , and so on.
Symbol: we write slot j to mean "the box at index j ."
Picture: think of a row of lockers with numbers painted on the doors.
m
==m == is the number of boxes in the array — its length. If m = 7 , the valid indices are 0 , 1 , 2 , 3 , 4 , 5 , 6 and nothing else.
Why the topic needs it: every probe formula ends in "mod m " to keep the trail inside the array. Without m you could walk off the end of the shelf.
k
A key k is the value we want to store and later look up — a number, a name, an ID. In the parent's examples the keys are numbers like 5 , 10 , 15 .
Picture: the label on the item you're putting in a locker.
Why needed: every operation (insert, search, delete) is about a key . Everything else exists to answer "where does key k live?"
We can't search all m boxes for every key — that would defeat the point of a fast table. We need a rule that jumps straight to a likely box. That rule is the hash function.
h ( k )
A hash function h takes a key k and returns an index in { 0 , 1 , … , m − 1 } — the box where we first try to put or find k .
Picture: a machine with k going in the top and a locker number falling out the bottom.
The parent uses h ( k ) = k mod m (see the modulo below).
Definition The modulo operation
mod
a mod m means "the remainder after dividing a by m ." It always lands in 0 … m − 1 , which is exactly the set of valid indices.
Example: 15 mod 5 = 0 because 15 = 3 × 5 + 0 . And 17 mod 5 = 2 because 17 = 3 × 5 + 2 .
Why this tool and not plain division? Division could give you 3.4 , which is not a box number. We need a whole number inside the shelf ; mod m is precisely the operation that "wraps" any integer back into 0 … m − 1 . That wrapping is why the trail can loop from the last box back to box 0 .
Answer these before moving on:
17 mod 5 2
10 mod 5 0
Why does every index formula end in mod m ? To keep the result a valid box index inside the array (and to wrap past the end back to 0 ).
A collision happens when two different keys hash to the same starting box, i.e. h ( k 1 ) = h ( k 2 ) but k 1 = k 2 . Only one key can sit in a box, so the second needs a backup plan.
Picture: two people assigned locker 3, but the locker holds one bag.
In the parent, A, B, C all have hash 3 — three keys, one starting box. Collisions are why we need probing at all.
There are two families of fixes for collisions. The parent lives in open addressing ; knowing the other one sharpens what "open" means.
Definition Two collision strategies
Separate chaining : each box holds a little linked list; colliding keys all hang off the same box. Deletion is easy (just unlink). See Separate Chaining .
Open addressing : every key lives directly in the array — no lists. A colliding key must find a different empty box by trying others in order. See Open Addressing .
Because open addressing keeps everything in the one array, deleting a key leaves a gap inside the array itself — and that gap is the whole problem the tombstone solves. Separate chaining never has this issue.
Since a colliding key can't use its first box, it tries others in a fixed, repeatable order. That ordered list of boxes is the probe sequence.
Definition Probe, and probe index
i
A probe is one attempt to look at a box. We number attempts with ==i == starting at 0 : the 0 -th probe is the first box we try, the 1 -st probe the next, and so on.
Worked example Reading the trail
With m = 7 and h ( k ) = 3 : the probe sequence is
h ( k , 0 ) = 3 , h ( k , 1 ) = 4 , h ( k , 2 ) = 5 , h ( k , 3 ) = 6 , h ( k , 4 ) = 0 , …
Notice how after box 6 it wraps to box 0 — that wrap is the mod 7 at work.
Every box is always in exactly one of three states. The parent's whole argument turns on telling them apart.
Definition EMPTY, OCCUPIED, DELETED
EMPTY : never held a key on this trail → search stops here ("not present").
OCCUPIED : currently holds a key → check if it's the one we want; if not, keep probing.
DELETED (the tombstone , written † ): a key was here but was removed → search keeps probing , insert may reuse it.
Picture: an empty locker (open door, nothing), a full locker (a bag), and a locker with a "used to be here" sticky note.
The single most important distinction — and the reason tombstones exist:
To talk about cost , we need one number for "fullness."
Definition Live load factor
α
==α === m n occupied , where n occupied is the count of OCCUPIED boxes. It runs from 0 (empty table) to 1 (full table).
Picture: the fraction of lockers with a real bag inside.
The parent extends this to α eff (effective load factor), which also counts tombstones in the numerator — because search must walk past them too. See Load Factor and Rehashing .
Self-test:
If m = 5 and 3 boxes are OCCUPIED, what is α ? 3/5 = 0.6
If additionally 1 box is a tombstone, what is α eff ? ( 3 + 1 ) /5 = 0.8
Search stops at EMPTY invariant
Load factor and alpha eff
Test yourself — you should be able to answer each without looking up.
What is an array index, and where does counting start? The address of a box in the row; counting starts at 0 .
What does m stand for? The table size — the number of boxes in the array.
What does a hash function h ( k ) produce? A starting box index in { 0 , … , m − 1 } for key k .
Compute 15 mod 5 . 0 .
Why does every probe formula end in mod m ? To keep the index inside the array and wrap the last box back to 0 .
What is a collision? Two different keys hashing to the same box.
Difference between open addressing and separate chaining? Open addressing stores every key inside the array; separate chaining hangs colliding keys off linked lists.
Write the linear-probing sequence formula. h ( k , i ) = ( h ( k ) + i ) mod m .
What are the three slot states? EMPTY, OCCUPIED, DELETED (tombstone).
What opposite messages do EMPTY and DELETED send to a search? EMPTY says "stop, not here"; DELETED says "keep probing."
Define the live load factor α . n occupied / m .
Define α eff . ( n occupied + n tombstones ) / m .
Parent: tombstone deletion — where all of this is put to work.
Hash Functions — the h ( k ) that starts every probe.
Open Addressing — the family this topic belongs to.
Linear Probing — the specific probe rule used above.
Separate Chaining — the alternative where deletion is trivial.
Load Factor and Rehashing — where α and α eff drive rebuilds.