dev/avl_tries.cpp
Node *rightRotate(Node *y)
{
	Node *x = y->left;
	Node *T2 = x->right;

	// Perform rotation
	x->right = y;
	y->left = T2;

	// Update heights
	y->height = max(height(y->left),
					height(y->right)) +
				1;
	x->height = max(height(x->left),
					height(x->right)) +
				1;

	// Return new root
	return x;
}
// A utility function to right
// rotate subtree rooted with y
// See the diagram given above.
A utility function to right
rotate subtree rooted with y
See the diagram given above.
A utility function to right rotate subtree rooted with y See the diagram given above .
Node *rightRotate(Node *y)
{
	Node *x = y->left;
	Node *T2 = x->right;
	x->right = y;
	y->left = T2;
	y->height = max(height(y->left),
					height(y->right)) +
				1;
	x->height = max(height(x->left),
					height(x->right)) +
				1;
	return x;
}
Node * rightRotate ( Node * y ) { Node * x = y -> left ; Node * T2 = x -> right ; x -> right = y ; y -> left = T2 ; y -> height = max ( height ( y -> left ) , height ( y -> right ) ) + 1 ; x -> height = max ( height ( x -> left ) , height ( x -> right ) ) + 1 ; return x ; }
A utility function to right
rotate subtree rooted with y
See the diagram given above.
A utility function to right rotate subtree rooted with y See the diagram given above .
// Perform rotation // Update heights // Return new root