Пример #1
0
static BTREE_NODE *btree_successor(BTREE_NODE *x)
{
	BTREE_NODE *y;

	if (x->right != NULL) {
		return (btree_min(x->right));
	}

	y = x->parent;
	while (y != NULL && x == y->right) {
		x = y;
		y = y->parent;
	}

	return (y);
}
Пример #2
0
static btree_node_t*
btree_successor(btree_node_t *x)
{
    btree_node_t *y;

    if (x->right != NULL) {
        return btree_min(x->right);
    }

    y = x->parent;
    while (y != NULL && x == y->right) {
        x = y;
        y = y->parent;
    }

    return y;
}
Пример #3
0
int acl_btree_get_min_key(ACL_BTREE *tree, unsigned int *key)
{
	BTREE_NODE *x;

	btree_validate(tree);
	if (tree->root == NULL) {
		return (-1);
	}

	x = btree_min(tree->root);
	if (x == NULL) {
		return (-1);
	}
        
	*key = x->key;
	return (0);
}
Пример #4
0
int
btree_get_min_key(btree_t *tree, uint32_t *key)
{
    btree_node_t *x;

    btree_validate(tree);
    if (tree->root == NULL) {
        return FALSE;
    }

    x = btree_min(tree->root);
    if (x == NULL) {
        return FALSE;
    }

    *key = x->key;
    return TRUE;
}