G27
Self-checkedTier 1 14 min readalgo.hashing-chaining-open

Chaining and open addressing

The two ways to resolve collisions: chaining (one linked list per slot) and open addressing (linear probing, quadratic probing, double hashing). Insert, search and delete in each, probe sequences and when they cover the whole table, primary and secondary clustering, why deletion in open addressing needs a tombstone, and how to decide whether a given table could have been produced by a sequence of insertions.

Why it exists

Two keys with the same hash value must both be stored and both be found later. There are two basic ideas. Chaining gives every slot a list, so collisions simply share a list. Open addressing keeps all keys in the table itself and, when the home slot is taken, probes other slots by a fixed rule. Chaining is simple and degrades gracefully; open addressing saves the pointers and has good cache behaviour but fails if the table fills up and needs care when deleting. GATE asks about the exact table after a sequence of insertions, about probe sequences, and about what goes wrong with deletion.

Prerequisites

You need hash functions, collisions and the load factor (hashing) and linked lists (linked lists).

Precise definitions

Chaining (separate chaining). Slot jj of the table holds the head of a linked list of all keys kk with h(k)=jh(k) = j.

  • Insert: compute h(k)h(k) and put the new node at the front of that list: Θ(1)\Theta(1) (after checking that the key is not already present, if duplicates are not allowed, which costs a search).
  • Search: walk down the list of slot h(k)h(k) comparing keys.
  • Delete: find the node and unlink it (a doubly linked list gives Θ(1)\Theta(1) once the node is found).

Open addressing. At most one key per slot, so n≤mn \le m always. A probe sequence h(k,0),h(k,1),…,h(k,m−1)h(k, 0), h(k, 1), \ldots, h(k, m-1) says which slots to try for key kk. For correctness it must be a permutation of 0,…,m−10, \ldots, m-1 (every slot is eventually tried).

  • Insert: try the slots of the probe sequence until one is empty (or deleted).
  • Search: try the slots in order until the key is found (success) or an empty slot is reached (failure: if the key were present it would have been placed there or earlier).
  • Delete: the slot is marked DELETED (a tombstone), never just emptied.

The three standard probe sequences, with h′(k)=k mod mh'(k) = k \bmod m:

Schemeh(k,i)h(k, i)Remark
Linear probing(h′(k)+i) mod m(h'(k) + i) \bmod mvisits all slots; clusters
Quadratic probing(h′(k)+c1i+c2i2) mod m(h'(k) + c_1 i + c_2 i^2) \bmod mvisits all slots only for special m,c1,c2m, c_1, c_2
Double hashing(h1(k)+i h2(k)) mod m(h_1(k) + i\,h_2(k)) \bmod mvisits all slots iff gcd⁡(h2(k),m)=1\gcd(h_2(k), m) = 1

Clustering. Primary clustering: in linear probing a run of occupied slots grows whenever a key hashes anywhere into it, so long runs get longer. Secondary clustering: in quadratic probing keys with the same home slot follow the same sequence. Double hashing avoids both because the step depends on the key.

How it works

Chaining in action

The animation inserts 45,16,29,78,33,60,14,9245, 16, 29, 78, 33, 60, 14, 92 into 1111 buckets with h(k)=k mod 11h(k) = k \bmod 11 and then searches for 78,45,100,978, 45, 100, 9. The code is the real code; the picture is read from the real list nodes. New nodes go to the front, so 7878 stands before 4545.

A hash table with chaining: key mod 11, one linked list per bucket

Real run

C source

1#include <stdio.h>
2#include <stdlib.h>
3
4#define M 11
5
6struct node {
7 int key;
8 struct node *next;
9};
10
11static struct node *table[M];
12
13static int hash(int key) {
14 return key % M;
15}
16
17void insert(int key) {
18 int h = hash(key);
19 struct node *p = malloc(sizeof *p);
20 p->key = key;
21 p->next = table[h];
22 table[h] = p;
23}
24
25int search(int key) {
26 int h = hash(key);
27 for (struct node *p = table[h]; p != NULL; p = p->next) {
28 if (p->key == key) {
29 return 1;
30 }
31 }
32 return 0;
33}

Buckets 0 to 10 (each bucket is a linked list; the newest key is at the front)

0→ NULL
1→ NULL
2→ NULL
3→ NULL
4→ NULL
5→ NULL
6→ NULL
7→ NULL
8→ NULL
9→ NULL
10→ NULL

State

keys stored n = 0, buckets m = 11, load factor n / m = 0 / 11, key comparisons in this search = 0

Blue = the position this step is working on, amber = a position being compared, red = positions just swapped, green = finished or in its final place, a filled blue cell = a value just placed, faded = not part of the structure at this step.

Step 1

An empty table of 11 buckets. Insert 45, 16, 29, 78, 33, 60, 14, 92, then search.

1 / 31
The eight keys 45, 16, 29, 78, 33, 60, 14, 92 are inserted by hidden driver code, then 78, 45, 100 and 9 are searched. insert() and search() are the exact code that runs. The panel is read from the real linked lists. Produced by: real execution: every array, stack, matrix and list in the picture is read from the running program's memory at each step. Apple clang version 21.0.0 (clang-2100.1.1.101). gcc -O0 -o prog prog.c && ./prog

An unsuccessful search for 100100 (bucket 11) walks the whole chain, 22 comparisons; for 99 (bucket 99, empty) it makes no comparison. The cost of a search is the length of one chain: Θ(1+α)\Theta(1 + \alpha) on average, Θ(n)\Theta(n) if all keys share a bucket. The table never becomes "full": α\alpha may exceed 11.

Open addressing in action

The same eight keys, then 5656, are inserted with linear probing; then 7878 is deleted and 5656 and 100100 are searched. A blank slot is empty, an x is a tombstone. Watch the keys 7878 and 6060 (home slots 11 and 55 already taken, so they move one slot on), and the eight probes of key 5656: its home slot 11 is the start of a run of occupied slots (slots 11 to 77), and it has to walk through all of them. The final search for the absent key 100100 (home slot 11 as well) takes nine probes, because it stops only at the empty slot 99.

Open addressing with linear probing, and why deletion needs a tombstone

Real run

C source

1#include <stdio.h>
2
3#define M 11
4#define EMPTY (-1)
5#define DELETED (-2)
6
7static int table[M] = {EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY};
8
9/* returns the slot used, or -1 if the table is full */
10int insert(int key) {
11 int h = key % M;
12 for (int i = 0; i < M; i++) {
13 int idx = (h + i) % M;
14 if (table[idx] == EMPTY || table[idx] == DELETED) {
15 table[idx] = key;
16 return idx;
17 }
18 }
19 return -1;
20}
21
22/* returns the slot of key, or -1 if it is absent */
23int search(int key) {
24 int h = key % M;
25 for (int i = 0; i < M; i++) {
26 int idx = (h + i) % M;
27 if (table[idx] == EMPTY) {
28 return -1;
29 }
30 if (table[idx] == key) {
31 return idx;
32 }
33 }
34 return -1;
35}
36
37void delete_key(int key) {
38 int idx = search(key);
39 if (idx >= 0) {
40 table[idx] = DELETED;
41 }
42}

Table of 11 slots (blank = empty, x = deleted)

0
1
2
3
4
5
6
7
8
9
10

State

keys stored n = 0, slots m = 11, probes in this operation = 0

Blue = the position this step is working on, amber = a position being compared, red = positions just swapped, green = finished or in its final place, a filled blue cell = a value just placed, faded = not part of the structure at this step.

Step 1

An empty table of 11 slots, hash = key mod 11, linear probing (try the next slot). Insert 45, 16, 29, 78, 33, 60, 14, 92.

1 / 53
The eight keys 45, 16, 29, 78, 33, 60, 14, 92 are inserted by hidden driver code, then 56 is inserted, 78 deleted, and 56 and 100 searched. The shown functions are the exact code that runs. In the picture an empty slot is blank and a deleted slot shows x. Produced by: real execution: every array, stack, matrix and list in the picture is read from the running program's memory at each step. Apple clang version 21.0.0 (clang-2100.1.1.101). gcc -O0 -o prog prog.c && ./prog

Why deletion needs a tombstone. After 7878 is deleted from slot 22, the key 5656 (home slot 11, stored in slot 88) must still be found: its probe sequence is 1,2,3,…,81, 2, 3, \ldots, 8. If slot 22 were set to empty, the search for 5656 would stop at slot 22 ("an empty slot, so the key is absent") and report the wrong answer. A tombstone says "continue". Searches pass over tombstones; insertions may reuse them. The price: tombstones lengthen searches, so the table is rebuilt from time to time. (With chaining none of this arises.)

The three probe rules side by side

The program below inserts the same ten keys into an empty table of 1111 slots with the three rules (linear; quadratic with c1=0,c2=1c_1 = 0, c_2 = 1; double hashing with h2(k)=1+(k mod 10)h_2(k) = 1 + (k \bmod 10), which lies between 11 and 1010 and is coprime to the prime 1111) and prints the probes used by each key and the final table. It also counts how many different slots the first 1111 probes of one key visit.

#include <stdio.h>
 
#define M 11
#define EMPTY (-1)
 
static int table[M];
 
/* slot examined at probe number i (i = 0, 1, 2, ...) for the given key and scheme */
static int slot(int scheme, int key, int i) {
    int h1 = key % M;
    if (scheme == 0) return (h1 + i) % M;                    /* linear probing */
    if (scheme == 1) return (h1 + i * i) % M;                /* quadratic probing, h + i^2 */
    int h2 = 1 + key % (M - 1);                              /* double hashing: step between 1 and 10 */
    return (h1 + i * h2) % M;
}
 
int main(void) {
    const char *name[3] = {"linear", "quadratic", "double"};
    int keys[10] = {45, 16, 29, 78, 33, 60, 14, 92, 56, 23};
    for (int s = 0; s < 3; s++) {
        for (int b = 0; b < M; b++) table[b] = EMPTY;
        printf("%-10s probes per key:", name[s]);
        int total = 0;
        for (int k = 0; k < 10; k++) {
            int i = 0;
            while (i < M && table[slot(s, keys[k], i)] != EMPTY) i++;
            if (i == M) { printf(" fail"); continue; }
            table[slot(s, keys[k], i)] = keys[k];
            printf(" %d", i + 1);
            total += i + 1;
        }
        printf("  (total %d)\n           table:", total);
        for (int b = 0; b < M; b++) {
            if (table[b] == EMPTY) printf("  .");
            else printf(" %2d", table[b]);
        }
        printf("\n");
    }
    printf("\nnumber of different slots visited by the first %d probes of the key 5:\n", M);
    for (int s = 0; s < 3; s++) {
        int seen[M] = {0}, count = 0;
        for (int i = 0; i < M; i++) {
            int b = slot(s, 5, i);
            if (!seen[b]) { seen[b] = 1; count++; }
        }
        printf("%-10s %d of %d\n", name[s], count, M);
    }
    return 0;
}
linear     probes per key: 1 1 1 2 1 2 1 1 8 9  (total 27)
           table: 33 45 78 14 92 16 60 29 56 23  .
quadratic  probes per key: 1 1 1 2 1 2 1 1 4 fail  (total 14)
           table: 33 45 78 14 92 16 60 29  .  . 56
double     probes per key: 1 1 1 2 1 2 1 1 2 3  (total 15)
           table: 33 45  . 14 92 16 60 29 56 23 78
 
number of different slots visited by the first 11 probes of the key 5:
linear     11 of 11
quadratic  6 of 11
double     11 of 11

The same ten keys in three open addressing tables (m = 11): start

Computed by a script, not typed
schemeprobes for each key (in insertion order)total probesfinal table, slots 0 to 10
linear probing
quadratic probing
double hashing

Step 0

The keys 45, 16, 29, 78, 33, 60, 14, 92, 56, 23 are inserted in this order into an empty table of 11 slots with h(k) = k mod 11 and three probe rules. A dot is an empty slot.

0 / 3
computed by script: the quantities are measured by running C, or evaluated, one row at a time. python3 scripts/gen-algo-hash-traces.py

Three observations. Linear probing used 2727 probes: the keys 5656 and 2323 both had to cross the run of occupied slots (probes 88 and 99). Double hashing needed only 1515, because the step differs from key to key, so keys from the same run take different paths. Quadratic probing with h+i2h + i^2 failed to insert the last key although slots 88 and 99 were empty: its sequence visits only 66 of the 1111 slots (the last line of the output) and all six were occupied. A probe sequence that is not a permutation of the slots can miss free slots.

When do the sequences cover the whole table?

  • Linear probing: always.
  • Double hashing: exactly when gcd⁡(h2(k),m)=1\gcd(h_2(k), m) = 1. Standard ways: mm prime and 1≤h2≤m−11 \le h_2 \le m - 1, or m=2pm = 2^p and h2h_2 odd.
  • Quadratic probing: for mm prime, h+i2h + i^2 visits only (m+1)/2(m + 1)/2 slots; h+(i+i2)/2h + (i + i^2)/2 (that is, the triangular numbers) visits every slot when mm is a power of two. So the constants and mm must be chosen together.

Which tables are possible? For a table built by insertions only (no deletions) with linear probing, every key sits at a slot such that all slots from its home slot up to its own slot are occupied (otherwise it would have been placed earlier). This is a quick necessary test for "which of the following tables could result from inserting these keys" questions; the order of insertion decides which of two keys with the same home slot comes first.

Resizing. When α\alpha grows too large the table is rebuilt with a larger mm (often doubled) and every key is rehashed, because hh depends on mm. The cost of rebuilding, Θ(n)\Theta(n), is spread over the insertions that led to it, so the amortized cost per insertion stays constant. Open addressing is usually resized at α≈0.5\alpha \approx 0.5 to 0.750.75; chaining tolerates α≈1\alpha \approx 1 or more.

Worked examples

EX 1Build a chained table

Easy

m=11m = 11, h(k)=k mod 11h(k) = k \bmod 11, keys 45,16,29,78,33,60,14,9245, 16, 29, 78, 33, 60, 14, 92 inserted at the front of the lists. Buckets: 0:330: 33; 1:78→451: 78 \to 45; 3:143: 14; 4:924: 92; 5:60→165: 60 \to 16; 7:297: 29; the others are empty. The longest chain has length 22, α=8/11=0.73\alpha = 8/11 = 0.73. If the keys are inserted in the opposite order, the buckets are the same but each chain is reversed: 45→7845 \to 78 and 16→6016 \to 60.

EX 2Linear probing by hand

Easy

Same keys, linear probing. 45→145 \to 1, 16→516 \to 5, 29→729 \to 7; 7878 wants slot 11 (taken), goes to 22; 33→033 \to 0; 6060 wants 55 (taken), goes to 66; 14→314 \to 3; 92→492 \to 4. Final table, slots 00 to 1010: 33,45,78,14,92,16,60,29,−,−,−33, 45, 78, 14, 92, 16, 60, 29, -, -, -. Probes per key: 1,1,1,2,1,2,1,11, 1, 1, 2, 1, 2, 1, 1. A successful search of 6060 takes 22 probes; an unsuccessful search for a key with home slot 11 takes 88 probes (slots 11 to 88, ending at the empty slot 88).

EX 3Double hashing

Medium

m=11m = 11, h1(k)=k mod 11h_1(k) = k \bmod 11, h2(k)=1+(k mod 10)h_2(k) = 1 + (k \bmod 10). For k=56k = 56: h1=1h_1 = 1, h2=7h_2 = 7. The sequence is 1,8,15 mod 11=4,22 mod 11=0,…1, 8, 15 \bmod 11 = 4, 22 \bmod 11 = 0, \ldots. In the table of the program, 5656 went to slot 88 after 22 probes (slot 11 was taken), where linear probing needed 88. The step 77 is coprime to 1111, so after 1111 probes all slots would have been visited.

EX 4A deletion trap

Medium

Linear probing, m=7m = 7, h(k)=k mod 7h(k) = k \bmod 7. Insert 1010 (slot 33), 1717 (slot 33 taken, goes to 44), 2424 (slots 33, 44 taken, goes to 55). Delete 1717 by emptying slot 44. Search 2424: probe slot 33 (1010, no), slot 44 is empty: the search stops and answers "absent", but 2424 is in slot 55. With a tombstone in slot 44 the search continues to slot 55 and finds it.

EX 5Which table is possible?

GATE level

m=10m = 10, h(k)=k mod 10h(k) = k \bmod 10, linear probing, keys inserted in the order 42,23,34,52,46,3342, 23, 34, 52, 46, 33. Simulate: 42→242 \to 2; 23→323 \to 3; 34→434 \to 4; 5252: home 22 (taken), 33 (taken), 44 (taken), 55: slot 55; 46→646 \to 6; 3333: home 33 taken, 44, 55, 66 taken, slot 77. Table: slots 22 to 77 hold 42,23,34,52,46,3342, 23, 34, 52, 46, 33. In any valid table every key must have all slots from its home slot to its position occupied: 3333 at slot 77 with home 33 needs slots 33 to 77 occupied: true. The table with 4242 and 5252 swapped (so 5252 in slot 22 and 4242 in slot 55) passes the same test but is not the result of this insertion order; it would result from inserting 5252 before 4242. The test is necessary, not sufficient: the order of insertion must also be consistent.

Cheat box

Cheat box

  • Chaining: list per slot, insert at the front Θ(1)\Theta(1), search Θ(1+α)\Theta(1 + \alpha) expected, Θ(n)\Theta(n) worst; α\alpha can exceed 11; no tombstones.
  • Open addressing: all keys in the table, n≤mn \le m, probe sequence must be a permutation of the slots; search stops at an empty slot; delete = tombstone.
  • Linear h′+ih' + i: all slots, primary clustering. Quadratic: secondary clustering, covers all slots only for special parameters (h+i2h + i^2 with prime mm: (m+1)/2(m+1)/2 slots). Double h1+ih2h_1 + i h_2: all slots iff gcd⁡(h2,m)=1\gcd(h_2, m) = 1; best distribution.
  • Valid linear probing table: all slots between a key's home and its position are occupied.
  • Resize when α\alpha is large; rehash everything; amortized O(1)O(1).

Traps and GATE patterns

Connections

The hash functions and the idea of the load factor are in hashing; the expected costs of these schemes as a function of α\alpha are in load factor and expected probes. Chaining uses linked lists and open addressing uses arrays.

PYQs

9 previous year questions from your book. I re-solved each one myself (9 by running or simulating, 0 by reasoning only); the book's key is shown next to my answer. All PYQs

GATE 2026 · Set 1Q1 · page 88 of the book
Consider a hash table P[0, 1, ..., 10] that is initially
empty. The hash table is maintained using open
addressing with linear probing. The hash function
used is :
h(x) = (x + 7) mod 11. Consider the following
sequence of insertions performed on
P: 1, 13, 22, 15, 11, 24
Which of the following positions in the hash table
is/are empty after these insertions are performed?
collisions. Let k be the number of keys, m be the
number of slots in the hash table, and k>m.
Which one of the following is the best hashing
strategy to counteract the adversary?
  • (a)Division method, i.e., use the hash function h(k) = k mod m
  • (b)Universal hashing method.
  • (c)Multiplication method, i.e., use the hash function h(k) = ⌊m(kA -⌊kA⌋)⌋ , where A is a carefully chosen constant.
  • (d)If k is a prime number, use Division method. Otherwise, use Multiplication method.
  • (a)0
  • (b)10
  • (c)2
  • (d)1
GATE 2026 · Set 2Q2 · page 88 of the book
The keys 5, 28, 19, 15, 26, 33, 12, 17, 10 are
inserted into a hash table using the hash function
h(k) = k mod 9. The collisions are resolved by
chaining. After all the keys are inserted, the length
of the longest chain is
.
year not read yetQ3 · page 88 of the book
In a double hashing scheme, h1(k) = k mod 11
and h2(k) = 1 + (k mod 7) are the auxiliary hash
functions. The size m of the hash table is 11. The
hash function for the i-th probe in the open address
table is
[h1(k) + ih2(k)] mod m The following keys are
inserted in the given order: 63, 50, 25, 79, 67, 24.
The slot at which key 24 gets stored is
.
(Answer in integers)
GATE 2020Q7 · page 89 of the book
Consider a double hashing scheme in which the
primary hash function is h1(k) = k mod 23, and
the secondary hash function is h2(k) = 1 +
(kmod19). Assume that the table size is 23. Then
the address returned by probe 1 in the probe
sequence (assume that the probe sequence begins at
probe 0) for key value k=90 is
.
GATE 2015 · Set 1Q8 · page 89 of the book
A hash table of length 10 uses open addressing with
hash function h(k) = k mod 10, and linear
probing. After inserting 6 values into an empty hash
table, the table is as shown below

How many different insertion sequences of the key
values using the same hash function and linear
probing will result in the hash table shown above?
  • (a)10
  • (b)20
  • (c)30
  • (d)
GATE 2015 · Set 1Q9 · page 89 of the book
Which one of the following choices gives a possible
order in which the key values could have been
inserted in the table?
  • (a)46, 42, 34, 52, 23, 33
  • (b)34, 42, 23, 52, 33, 46
  • (c)46, 34, 42, 23, 52, 33
  • (d)42, 46, 33, 23, 34, 52
GATE 2014 · Set 1Q11 · page 89 of the book
Consider a hash table with 9 slots. The hash function
is h(k) = k mod 9. The collisions are resolved by
chaining. The following 9 keys are inserted in the
order: 5, 28, 19, 15, 20, 33, 12, 17, 10. The maximum,
minimum, and average chain lengths in the hash
table, respectively, are
  • (a)3,0,and 1
  • (b)3,3,and 3
  • (c)4,0,and 1
  • (d)3,0,and 2
GATE 2009Q13 · page 90 of the book
The keys 12,18,13,2,3,23,5 and 15 are inserted
into an initially empty hash table of length 10 using
open addressing with hash function h(k) = k mod
10 and linear probing. What is the resultant hash
table ?
  • (a)0 1 2 2 3 2 4 5 1 6 7 8 1 9
  • (b)
  • (c). 0 1 2 12 3 13 4 2 5 3 6 23 7 5 8 18 9 15
  • (d). 0 1 2 12,2 3 13,3,23 4 5 5,15 6 7 8 18 9
GATE 2008 · Set 1Q14 · page 90 of the book
Consider a hash table of size seven, with starting
index zero, and a hash function h(x) = (3x + 4) mod
7 . Assuming the hash table is initially empty, which
of the following is the contents of the table when the
sequence 1, 3, 8, 10 is inserted into the table using
closed hashing?
Note that "–" denotes an empty location in the table.
  • (a)8, –, –, –, –, –, 10
  • (b)1, 8, 10, –, –, –, 3
  • (c)1, –, –, –, –, –, 3
  • (d)1, 10, 8, –, –, –, 3 0 1 2 12 3 13 4 5 5 6 7 8 18 DATA STRUCTURE

Self-check

Question 1

Insert 12,22,3212, 22, 32 into a table of 1010 slots with h(k)=k mod 10h(k) = k \bmod 10 using linear probing. Where does each key go?

Show answer

12→212 \to 2; 2222 (home 22 taken) →3\to 3; 3232 (home 22, then 33 taken) →4\to 4.

Question 2

Why is a deleted slot in open addressing marked DELETED instead of EMPTY?

Show answer

A search stops at the first empty slot; emptying a slot would stop searches for keys that were placed beyond it in a probe sequence and make them seem absent.

Question 3

What condition makes double hashing visit every slot of the table?

Show answer

gcd⁡(h2(k),m)=1\gcd(h_2(k), m) = 1, for example mm prime with 1≤h2(k)<m1 \le h_2(k) < m.

Question 4

Can a hash table with chaining hold more keys than it has slots?

Show answer

Yes: the lists simply get longer (load factor above 11); open addressing cannot.

Revision card

One-screen revision

  • Chaining: list per slot, front insertion, search Θ(1+α)\Theta(1 + \alpha), α\alpha may exceed 11.
  • Open addressing: n≤mn \le m; probe sequence a permutation; stop at EMPTY; delete with tombstone.
  • Linear: primary clustering. Quadratic: secondary clustering, parameters matter. Double: h1+ih2h_1 + i h_2, gcd⁡(h2,m)=1\gcd(h_2, m) = 1.
  • Valid table: slots from home to position occupied. Resize and rehash at high α\alpha.

References

  • ·Cormen, Leiserson, Rivest, Stein, Introduction to Algorithms (3rd edition), Chapter 11 Hash Tables (11.2 collision resolution by chaining, 11.4 open addressing)
  • ·Sedgewick and Wayne, Algorithms (4th edition), Section 3.4 Hash Tables (separate chaining, linear probing)
  • ·Knuth, The Art of Computer Programming, Volume 3, Section 6.4 Hashing

Verification

Both animations are real runs of the C code shown (chaining with insertion at the front of the list; linear probing with a tombstone). The C program on this page produced the probe counts and tables of the three open addressing schemes, which were replayed in Python. Verified by exhaustive checks in Python: linear probing visits every slot; double hashing visits every slot exactly when gcd(h2, m) = 1 (all m below 31); h + i^2 visits (m + 1)/2 different slots for the primes tested; the triangular numbers i(i+1)/2 visit every slot exactly when m is a power of two (all m below 70); the necessary condition on a linear probing table (every slot between a key's home and its position is occupied) held for 3000 random insertion sequences; and the failure of a search after a deletion that empties the slot was reproduced. Textbook chapter references are from memory. SECOND PASS (2026-11-02, done by the assistant, not a human check): every Self-check question was solved before the printed answer was read and all agreed; the definitions, worked examples, cheat box and traps were read claim by claim and the numbers re-derived by hand or by a small script (loop counts, recurrences, merge and quicksort counts and averages, hash probes and load-factor formulas, DP tables, MST and shortest-path runs, Floyd matrices); long C programs were not re-read line by line (they are compiled and compared by npm run verify:c, and their printed outputs were checked against the prose); tables and animations are machine output and were read, not re-run; The text said key 56 needs nine probes in the linear-probing animation; it needs eight (the nine belong to the later search for the absent key 100). Status raised to self-checked; verified needs a textbook or human check.

last verified: never