node* rightrotate(struct node *y) { struct node *x = y->left; struct node *z = x->right; x->right = y; y->left = z; y->h = max(h(y->left), h(y->right))+1; x->h = max(h(x->left), h(x->right))+1; return x; } node* leftrotate(struct node *x) { struct node *y = x->right; struct node *z = y->left; y->left = x; x->right = z; y->h = max(h(y->left), h(y->right))+1; x->h = max(h(x->left), h(x->right))+1; return y; }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)