RL RotationRL rotations is to be performed if the new node is inserted into the left of right subtree of the critical node A. Let us consider, Node B is the root of the right subtree of the critical node, Node C is the root of the subtree in which the new node is inserted. Let T1 be the left subtree of the critical node A, T2 and T3 be the left and right subtree of Node C respectively, subtree T4 be the right subtree of Node B. Since, RL rotation is the mirror image of LR rotation. In this rotation, the node C becomes the root node of the tree with A and B as its left and right children respectively. Subtrees T1 and T2 becomes the left and right subtrees of A whereas, T3 and T4 becomes the left and right subtrees of B. The process of RL rotation is shown in the following image. ExampleInsert node with the value 92 into the tree shown in the following figure. Solution :inserting 92 disturbs the balance factor of the node 92 and it becomes the critical node A with 105 as the node B and 95 with the node C. In RL rotation, C becomes the root of the tree (as shown in the figure) with node A (90) and B (105) as its left and right children respectively. The tree will be rotated as shown in the figure.
Next TopicDoubly Linked List
