How do you rotate a Binary Tree?
Rotations in the tree:
If after inserting a node in a Binary search tree, the balancing factor (height of left subtree - height of right subtree) of every node remains 0, 1 and -1 then there is no requirement of modification of original tree. If balancing factor of any node is either +2 or -2, the tree becomes unbalanced. It can be balanced by using left rotation or right rotation or a combination of both.