Coding With Fun
Home Docker Django Node.js Articles Python pip guide FAQ Policy

Is the lr rotation the same as the rl rotation?


Asked by Anaya Wright on Dec 11, 2021 FAQ



The LR Rotation is combination of single left rotation followed by single right rotation. In LR Rotation, first every node moves one position to left then one position to right from the current position. Right Left Rotation (RL Rotation) The RL Rotation is combination of single right rotation followed by single left rotation.
In addition,
The Left Right Rotation is combination of single left rotation followed by single right rotation. In LR Roration, first every node moves one position to left then one position to right from the current position. The Right Left Rotation is combination of single right rotation followed by single left rotation.
Likewise, The LL and RR rotations are called single rotations  . The combination of the two single rotations is called a double rotation  and is given the name LR rotation  because the first two edges in the insertion path from node Cboth go left and then right. Obviously, the left-right mirror image of the LR rotation is called an RL rotation  .
Also,
LR rotation is to be performed if the new node is inserted into the right of the left sub-tree of node A. In LR rotation, node C (as shown in the figure) becomes the root node of the tree, while the node B and A becomes its left and right child respectively.
Similarly,
In LR rotation, node C (as shown in the figure) becomes the root node of the tree, while the node B and A becomes its left and right child respectively. T1 and T2 becomes the left and right sub-tree of Node B respectively whereas, T3 and T4 becomes the left and right sub-tree of Node A.