private Node rotateRight(Node x){
  Node y=x.left;
  x.left=y.right;
  y.right=x;
  y.size=x.size;
  x.size=1 + size(x.left) + size(x.right);
  x.height=1 + Math.max(height(x.left),height(x.right));
  y.height=1 + Math.max(height(y.left),height(y.right));
  return y;
}

private Node rotateRight ( Node x ) { Node y = x . left ; x . left = y . right ; y . right = x ; y . size = x . size ; x . size = 1 + size ( x . left ) + size ( x . right ) ; x . height = 1 + Math . max ( height ( x . left ) , height ( x . right ) ) ; y . height = 1 + Math . max ( height ( y . left ) , height ( y . right ) ) ; return y ; }
rotates the given subtree to the right .
