loading…

RED-BLACK TREE

A red-black tree maintains balance through rotations and recoloring — nodes inserted one at a time trigger left/right rotations and color flips, guaranteeing O(log n) depth even under adversarial input.