Single Rotation Code
void RotateRight(Node *& root) {
Node * temp = root->right;
root->right = temp->left;
temp->left = root;
root->height = max(root->right->height,
root->left->height) + 1;
temp->height = max(temp->right->height,
temp->left->height) + 1;
root = temp;
}
root
temp
Previous slide
Next slide
Back to first slide
View graphic version