## Exercise

Consider the following BST:

Exercise How many rotations does it take to balance the above BST?

A) 1

B) 2

C) 3

## Solution

Let’s note the heights and balance factors in the original BST:

We can perform a left rotation to bring $4$ to the left of $5$:

We then perform another left rotation to bring $3$ to the left of $5$:

So the answer is **B**, two rotations.