AlgoScope

Red-Black Delete Fix-up

AlgorithmexpertRed-Black Tree

Removing a black node creates a "double black" that is pushed up or resolved by sibling cases.

Decision · step 2 of 7Red-Black Tree: Deleting a black node: the fixup cases
1020×30405060×7080×z

10 is a leaf: unlink it. The node leaving is black, so every path through it is now one black short and a fixup is needed.

Open in the player →or start at step 2

What you will see

Four sibling cases; the double-black token moves until it is absorbed.

How red-black tree works →

Cost

BestO(1)
AverageO(log n)
WorstO(log n)
SpaceO(1)

At most three rotations per delete.

How you work with it here

play it through, step one change at a time, scrub to any step, run it on your own input, predict what happens next, try operations in any order.

Screen readers: Nodes announce value, left child and right child; each step announces the comparison and the direction taken or the structural change.

Reduced motion: Focus jumps node to node with a static ring; rotations become a crossfade between the two layouts.

Taught by the same lesson

Red-Black Tree covers these too, in the same run.