The different rotations that were used are:
1) LR rotation :
- Here the new node is inserted in the left sub-tree of the left sub-tree of critical node.
- This rotation was used in step 4. Here 44 was the critical node.
- Here we need to carry out a rotation. After the rotation 32 became root node and the tree was balanced
2) RR rotation:
- Here the new node is inserted in the right sub-tree of the right subtree of the critical node.
- This rotation was used in step 9 in the above example. Here 32 was the critical node after 88 was inserted into it.
- Here we need to carry out a rotation. After rotation the tree gets balanced.
3) RL rotation:
- Here the new node is inserted in the right sub-tree of the left sub-tree of the critical node.
- This rotation was used in step 7 in the above example. Here 44 was the critical node after 50 was added to the tree.
- Here we need to carry out a rotation. After then RL rotation, the tree gets balanced