mirror of
https://gitee.com/apaki/unicstl.git
synced 2025-05-17 19:41:36 +08:00
换一组测试数据,发现还是存在问题。明天接着测试。
This commit is contained in:
parent
8f5a994802
commit
4b306fe831
13
src/tree.c
13
src/tree.c
@ -1480,10 +1480,11 @@ static struct _tree_node* tree_trun_left_then_right(struct _tree* self, struct _
|
||||
{
|
||||
assert(self != NULL);
|
||||
assert(root != NULL);
|
||||
assert(root->left != NULL);
|
||||
struct _tree_node* node = root->left;
|
||||
|
||||
tree_turn_left(self, root->left);
|
||||
if(node != NULL)
|
||||
{
|
||||
tree_turn_left(self, node);
|
||||
}
|
||||
node = tree_turn_right(self, root);
|
||||
return node;
|
||||
}
|
||||
@ -1492,9 +1493,11 @@ static struct _tree_node* tree_trun_right_then_left(struct _tree* self, struct _
|
||||
{
|
||||
assert(self != NULL);
|
||||
assert(root != NULL);
|
||||
assert(root->right != NULL);
|
||||
struct _tree_node* node = root->right;
|
||||
tree_turn_right(self, root->right);
|
||||
if(node != NULL)
|
||||
{
|
||||
tree_turn_right(self, node);
|
||||
}
|
||||
node = tree_turn_left(self, root);
|
||||
return node;
|
||||
}
|
||||
|
@ -279,8 +279,8 @@ void tree_test(void)
|
||||
void test_tree_num(void)
|
||||
{
|
||||
uint32_t i = 0;
|
||||
int data[] = { 1,2,3,4,5,6};
|
||||
// int data[] = { 5,2,3,1,7,8,6 };
|
||||
// int data[] = { 1,2,3,4,5,6};
|
||||
int data[] = { 5,2,3,1,7,8,6 };
|
||||
int temp = 0;
|
||||
uint32_t len = sizeof(data) / sizeof(data[0]);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user