Javatpoint Logo
Javatpoint Logo

RR Rotation

If the node is inserted into the right of the right sub-tree of a node A and the tree becomes unbalanced then, in that case, RR rotation will be performed as shown in the following diagram.

While the rotation, the node B becomes the root node of the tree. The critical node A will be moved to its left and becomes the left child of B.

The sub-tree T3 becomes the right sub-tree of A. T1 and T2 becomes the left and right sub-tree of node A.

RR Rotation in avl tree


Insert 90 into the AVL Tree shown in the figure.

RR Rotation in avl tree

Solution :

90 is inserted in to the right of the right sub-tree. In this case, critical node A will be 85, which is the closest ancestor to the new node, whose balance factor is disturbed. Therefore, we need to rebalance the tree by applying RR rotation onto it.

The node B will be the node 90 , which will become the root node of this sub-tree. The critical node 85 will become its left child, in order to produce the rebalanced tree which is now an AVL tree.

RR Rotation in avl tree
Next TopicDoubly Linked List

Youtube For Videos Join Our Youtube Channel: Join Now


Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Trending Technologies

B.Tech / MCA