algorithm leftrotation(node prenode right postnode right is the new root of the subtree node has become node right' left child and bst properties are preserved rightn ode node right node right rightn ode left rightn ode left node end leftrotation algorithm rightrotation(node prenode left postnode left is the new root of the subtree node has become node left' right child and bst properties are preserved lef tn ode node left node left lef tn ode right lef tn ode right node end rightrotation the right and left rotation algorithms are symmetric only pointers are changed by rotation resulting in an ( runtime complexitythe other fields present in the nodes are not changed tree rebalancing the algorithm that we present in this section verifies that the left and right subtrees differ at most in height by if this property is not present then we perform the correct rotation notice that we use two new algorithms that represent double rotations these algorithms are named leftandrightrotationand rightandleftrotation the algorithms are self documenting in their namese leftandrightrotation first performs left rotation and then subsequently right rotation