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

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

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

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