-
Notifications
You must be signed in to change notification settings - Fork 16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
remove_key not balanced and leave orphan nodes. #5
Comments
Result: |
testcase:
`static void print_sebrb(t_rbnode *n, int level, int seq)
{
int lvl = level;
if (lvl == 0 && n) {
printf("(%s:%d)\n", n->color ? "RED" : "BLK",
n->key);
} else {
while (--lvl >= 0) {
printf("| ");
}
printf("|---%s", seq ? "R" : "L");
if (!n) {
printf("(BLK, null)\n");
return ;
} else {
printf("(%s:%d)\n",
n->color ? "RED" : "BLK",
n->key);
}
}
if (n) {
print_sebrb(n->left, level + 1, 0);
print_sebrb(n->right, level + 1, 1);
}
}
TESTCASE(rbtree, ut_sebrbtree)
{
extern t_rbnode *root_rbtree;
int i;
int data[] = {
40, 30, 20, 50, 60, 55, 4, 24, 80, 33, 44, 11
};
int size = ARRAY_CNT(data);
t_rbnode *nodes = malloc(size * sizeof(t_rbnode));
t_rbnode *node;
}
`
The text was updated successfully, but these errors were encountered: