c_avl_node_t *y;
c_avl_node_t *b;
+ assert (x != NULL);
+ assert (x->left != NULL);
+
p = x->parent;
y = x->left;
b = y->right;
y->height = calc_height (y);
return (y);
-} /* void rotate_left */
+} /* void rotate_right */
/*
* (x) (y)
c_avl_node_t *y;
c_avl_node_t *b;
+ assert (x != NULL);
+ assert (x->right != NULL);
+
p = x->parent;
y = x->right;
b = y->left;
{
assert (n->right != NULL);
b_bottom = BALANCE (n->right);
- assert ((b_bottom >= -1) || (b_bottom <= 1));
+ assert ((b_bottom >= -1) && (b_bottom <= 1));
if (b_bottom == 1)
n = rotate_right_left (t, n);
else
{
assert (n->left != NULL);
b_bottom = BALANCE (n->left);
- assert ((b_bottom >= -1) || (b_bottom <= 1));
+ assert ((b_bottom >= -1) && (b_bottom <= 1));
if (b_bottom == -1)
n = rotate_left_right (t, n);
else
*value = n->value;
free_node (n);
+ --t->size;
rebalance (t, p);
return (0);