diff --git a/APP_Framework/Applications/app_test/test_rbtree/rbtree.c b/APP_Framework/Applications/app_test/test_rbtree/rbtree.c index 9dc7e8d5f..46783323f 100644 --- a/APP_Framework/Applications/app_test/test_rbtree/rbtree.c +++ b/APP_Framework/Applications/app_test/test_rbtree/rbtree.c @@ -31,13 +31,19 @@ static void inorder(RBTree tree) if(tree != NULL) { inorder(tree->left_child); - printf("%d ", tree->key); + printf("key:%d, color: ", tree->key); + if(tree->is_red==RED){ + printf("Red\n"); + }else{ + printf("Black\n"); + } inorder(tree->right_child); } } void RBTreeTraversal(RBRoot *root) { + printf("---------------------Inorder Traversal-----------------------------\n"); if (root) inorder(root->node); } diff --git a/APP_Framework/Applications/app_test/test_rbtree/test_rbtree.c b/APP_Framework/Applications/app_test/test_rbtree/test_rbtree.c index 14f6116aa..8368dc15c 100644 --- a/APP_Framework/Applications/app_test/test_rbtree/test_rbtree.c +++ b/APP_Framework/Applications/app_test/test_rbtree/test_rbtree.c @@ -13,18 +13,28 @@ int main(void) { char cmd; RBRoot *root = create_rbtree(); - // 构建红黑树 - printf("== 原始数据: "); - for (i = 0; i < ARRAY_SIZE(arr); i++) + int length = sizeof(arr) / sizeof(arr[0]); + printf("------------------------------------------------------------"); + printf("\nTest Red Black Tree \n"); + printf("default_key array: "); + for(int i=0;i