AVL tree notes part2

Right Rotate

In left-rotation, the arrangement of the nodes on the left is transformed into the arrangements on the right node.

1. Let the initial tree be:



2. If x has a right subtree, assign y as the             parent of the right subtree of x.

3.  If the parent of y is NULL, make x as the     root of the tree.
4.  Else if y is the right child of its parent p,        make x as the right child of p.
5.  Else assign x as the left child of p.


6. Make x as the parent of y.



Posted on by