换一组测试数据,发现还是存在问题。明天接着测试。

This commit is contained in:
建峰 2024-06-24 01:32:20 +08:00
parent 8f5a994802
commit 4b306fe831
2 changed files with 10 additions and 7 deletions

View File

@ -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;
}

View File

@ -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]);