While inserting a new node in a Binary Search Tree, there are four possibilities:

Case I: If new node is inserted in the left subtree of the left child of a, perform single right rotation.
Case II: If new node is inserted in the right subtree of the left child of a. perform left-right double rotation.
Case III: If new node is inserted in the left subtree of the right child of a. perform right-left double rotation.
Case IV: If new node is inserted in the right subtree of the right child of a, perform single left rotation.


Sponsored Links