Definition · A skip listA skip list on a sorted set of keys is a sequence of linked lists L₀ ⊇ L₁ ⊇ L₂ ⊇ …. L₀ contains every key. Each key in Lₖ appears in Lₖ₊₁ with probability 1/2, independently of every other key. A key's level is the highest list it appears in.
Equivalently, and this is how the lab builds it: each key reads the coin tape at its own position and takes the length of the run of heads there as its level. The tape is the reader's, chosen by a seed, so the structure is reproducible without being fixed — and the coins come from the prime-modulus stream, because the low bit of a power-of-two-modulus generator is not a coin and a structure built from one would have levels that repeat on a short cycle.
Definition · The searchTo find a target, start at the leftmost node of the highest level. Repeatedly: if the next node at this level exists and its key is not greater than the target, move to it; otherwise drop one level. Stop at level 0. Each move and each drop is a hop, and the hops are what the lab counts.
Example · Sixteen keys from one tapeKeys 10 to 160. The tape gives levels 1, 1, 2, 0, 0, 4, 0, 1, 0, 0, 1, 4, 1, 0, 1, 1, so 10 of the 16 keys reach at least level 1 and two reach level 4. Searching for key 120, which is at level 4, takes 2 hops; searching for key 100, which is at level 0 and is the second of two consecutive level-0 keys, takes 8. The mean over all sixteen searches is 77/16 = 4.813 and the worst is 8.
Those two searches are the lesson in miniature. Key 120 is one of the two tallest nodes, so the top-level walk reaches it in two hops. Key 100 has level 0 and must be reached by descending all the way and walking, so it costs 8. Same structure, same tape, a factor of four between two lookups — and the mean of the sixteen is a fraction, because a mean of integers is.
The level table, and where the halving is visible
level keys whose top level is this keys present at this level n/2^(k+1)
L0 6 16 8.00
L1 7 10 4.00
L2 1 3 2.00
L3 0 2 1.00
L4 2 2 0.50
The right-hand column is what the geometric cascade predicts and the middle column is what this tape produced. They are in the same neighbourhood and they are not equal: 10 keys present at level 1 against a predicted 8, and 2 at level 4 against a predicted 0.5. Level 3 is the row worth staring at — no key has 3 as its top level, and two keys are nevertheless present there, because a key at level 4 appears at every level below it.
That distinction between “top level is k” and “present at level k” is the commonest confusion in reading a skip list, and it is why the panel prints both columns. The first is a partition of the keys and adds to n; the second is a nested family and decreases as k grows.
What is guaranteed, and what the dashed curve is doing
The expected number of levels is O(log n) and the expected search cost is O(log n) as well: at each level the walk passes a constant number of nodes in expectation before dropping, because the probability that the next node is present one level up is a half. This course does not prove a concentration result around that expectation — the tail bound needed is a Chernoff bound and this course excludes it — so what is available is an expectation and the counts on screen.
So the panel draws 2 log₂ n as a dashed reference and labels it. At sixteen keys it reads 8.000 and the counted mean is 4.813; at eight keys it reads 6.000 and a different tape counted 3.250. The curve is not a bound, not an asymptote that has been proved here, and not a prediction; it is a familiar shape to read the counted points against, and the panel says so in those terms.
The search cost is also a random variable in the same way a treap's depth is, and for the same reason: the coins belong to the structure. A worst case of 8 hops on sixteen keys is this tape's worst case, and another tape gives another. Nothing here bounds it, and the honest statement is the one the panel makes — the mean is 77/16, the worst observed is 8, and both are counts on the structure drawn above them.
The trade against a balanced tree
An AVL tree guarantees a height, always, and pays with a stored height per node, a case analysis over four rotation shapes, and a rebalancing pass on every insertion and deletion. A skip list guarantees an expectation, and pays with nothing at all: an insertion writes a few pointers at the levels the coin chose, and no other node is touched. There is no global structure to maintain, which is the whole point of the design.
That absence is also what makes a skip list easy to get right and easy to make concurrent, and it is what makes its worst case unbounded. Which of those matters more is a question about the system rather than about the structure — the same question Universal Hashing asked about whether anyone can choose your keys.