mirror of
https://gitee.com/apaki/unicstl.git
synced 2025-07-03 23:56:54 +08:00
红黑树插入实现完成,如果检测其正确性呢?
This commit is contained in:
parent
411f0c1fa5
commit
bd3258010a
@ -1124,6 +1124,7 @@ static bool tree_rb_rebalance(struct _tree* self, struct _tree_node* node)
|
|||||||
}
|
}
|
||||||
grandfather->color = RBT_RED;
|
grandfather->color = RBT_RED;
|
||||||
tree_turn_right(self, grandfather);
|
tree_turn_right(self, grandfather);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -1149,6 +1150,7 @@ static bool tree_rb_rebalance(struct _tree* self, struct _tree_node* node)
|
|||||||
}
|
}
|
||||||
grandfather->color = RBT_RED;
|
grandfather->color = RBT_RED;
|
||||||
tree_turn_left(self, grandfather);
|
tree_turn_left(self, grandfather);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -249,6 +249,6 @@ void test_rbtree_num(void)
|
|||||||
|
|
||||||
void test_tree(void)
|
void test_tree(void)
|
||||||
{
|
{
|
||||||
test_avltree_num();
|
// test_avltree_num();
|
||||||
// test_rbtree_num();
|
test_rbtree_num();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user