## Right

Consider inserting the values $7, 5, 3$ in that order.

We start by inserting $7$:

We have a BST with a single node; it is balanced!

Next, we insert $5$.

Now our BST has two nodes. Notice the height and balance factor of the root has changed (and it is still balanced).

Next, we insert $3$.

Our BST has three nodes now. Notice the heights and balance factors of the parent and *grand parent* of $3$ have changed. In particular, the grand parent (the root) is not balanced anymore!

However, if we were to push $7$ to the **right** of $5$, we would restore balance:

This is called a (single) **right rotation**:

Notice the violation of balance property occurred in the grand parent of the newly inserted node. From the perspective of the grand parent node, __the problem was caused in left child’s left subtree.__ The solution is a (single) right rotation to bring the parent node (

*median*value) above the grand parent (

*high*value).