我还以为是你做了什么改动呢。原来又是我的一处bug,感谢指正。一会儿奖励你
我遍历的本意是按字典序输出信息字符串。bug是遍历顺序上的失误,调整成如下就好了。一会儿我会修改第一页中的代码。
由此也能看出软件维护的意义和成本有多大了。
程序代码:

我遍历的本意是按字典序输出信息字符串。bug是遍历顺序上的失误,调整成如下就好了。一会儿我会修改第一页中的代码。
由此也能看出软件维护的意义和成本有多大了。

void ternary_tree_travel_sub(TERNARY_TREE tree, char * string, int deep) { if(tree == NULL) return; ternary_tree_travel_sub(tree->left, string, deep); string[deep] = tree->key; if(tree->value != 0) { string[deep + 1] = '\0'; printf("%s <%d>\n", string, tree->value); } ternary_tree_travel_sub(tree->mid, string, deep + 1); ternary_tree_travel_sub(tree->right, string, deep); }

重剑无锋,大巧不工