## Definition

Consider these numbers: $3, 5, 7$. The following are valid binary search trees made up of the given numbers. However, only one is “balanced”.

It turns out, the four unbalanced trees can be *transformed* to the balanced one using **structural rotation**. (Notice the balanced one can be generated from the sequence $5, 3, 7$ or $5, 7, 3$.)

A structural rotation is an operation on a binary tree that changes the structure of the tree without affecting the order of the elements (as read in by an in-order traversal).

It is used to balance out two branches of different depths.

In a structural rotation, one node is shifted up, another is shifted down, and some of the remaining nodes may be shifted to ensure the tree is still a binary tree (each node only has 2 branches).

Structural rotations change the height of the tree by moving up larger subtrees.