A linked list is the simplest ordered structure there is: a chain of nodes, each pointing to the next. It is wonderfully easy to build, but searching it is painful — to find a value you walk node by node from the front, so a list of a million items can cost a million steps.
Balanced trees fix that with search, but they earn it with bookkeeping: every insertion may trigger rotations and rebalancing to keep the tree's shape under control. The code is fiddly and easy to get wrong.
In 1990, William Pugh asked a mischievous question: what if we keep the simple linked list, but add a few random express lanes on top? Some nodes get promoted to a higher level — by a coin flip — and those higher levels let a search skip over long stretches of the list. No rotations, no rebalancing. Just luck, applied consistently. The result is the skip list.
Comments
Loading comments...