BALANCE GROVE A little rotation. A shorter search.

THE TREE KEEPER'S WORKBENCH

Give every branch
room to grow.

Restore a search tree by rotating its branches. Tap a numbered node, then rotate left or right. Every node needs a balance factor between −1 and +1. Numbers must stay in sorted order.

Sorted walk

Rotations change search depth while keeping this left-to-right order intact.