HomeAlgorithms & AIRed-Black Tree Interval Partition Explorer (2D)

Red-Black Tree Interval Partition Explorer (2D)

Watch a red-black tree's insertion fix-up (uncle-red recoloring, LL/RR/LR/RL rotations) as a 2D recursive interval-partition diagram, with a live per-leaf black-height bar chart proving the balance invariant.

Algorithms & AI2DAdvanced60 FPS📱 Mobile-adapted⇄ 3D version
2d-red-black-tree-self-balancing-rotation ↗ Open standalone

Same insertion fix-up as the 3D Rotation Case Explorer — a red uncle recolor cascade, or the LL/RR/LR/RL rotation shapes — but rendered as a genuinely 2D-native diagram: a recursive partition of the key domain into nested horizontal slabs, one per node, exactly matching the BST ordering invariant those keys already obey. A second live panel turns invariant (4) — every root-to-null-leaf path carries the same black-node count — into a bar chart that visibly flattens out as the fix-up completes, giving a direct numerical read on why red-black trees stay at O(log n) height.

⚙ Under the hood

Step through the exact red-black tree insertion fix-up cases — uncle-red recoloring and the LL/RR/LR/RL rotation shapes — as a 2D recursive interval-partition diagram, with a live per-leaf black-height bar chart proving the balance invariant.

red-black treetree rotationbalanced BSTalgorithmsdata structuresinterval partition

2D · HTML5 Canvas 2D · 60 FPS target · runs fully client-side, no install

What did you find?

Add reproduction steps (optional)