设为首页 加入收藏

TOP

二叉树(Binary Tree)相关算法的实现(四)
2015-07-20 18:03:12 来源: 作者: 【 】 浏览:11
Tags:Binary Tree 相关 算法 实现
r(' ');
? ? ? ? putchar(root->data);putchar('\n');
? ? ? ? indOutput(root->left,k+1);
? ? ? ? indOutput(root->right,k+1);
? ? }
? ? else return;
}
?
void main()
{
? ? char c;
? ? struct bt * root;
? ? printf("请输入先序遍历结果: ");
? ? createBT(&root);
? ? printf("先序遍历(preOrder)[递归]: \n");
? ? preOrder(root);
? ? printf("\n中序遍历(inOrder)[递归]: \n");
? ? inOrder(root);
? ? printf("\n后序遍历(postOrder)[非递归]: \n");
? ? postOrder(root);
? ? printf("\n叶结点(leaves): \n");
? ? printLeaves(root);
? ? printf("\n深度(depth): \n");
? ? printf("%d\n",btDepth(root));
? ? printf("树形输出(tree output): \n");
? ? btOutput(root,0);
? ? printf("缩进输出(indentation output): \n");
? ? indOutput(root,0);
? ? printf("请输入目标结点(target node): ");
? ? getchar();
? ? c=getchar();
? ? printf("路径(path): \n");
? ? printPath(root,c);
? ? printf("按层输出(layerPrint): \n");
? ? layerPrint(root);
? ? printf("\n");
}
首页 上一页 1 2 3 4 下一页 尾页 4/4/4
】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
分享到: 
上一篇c++单列模式与线程安全 下一篇HDU3572_Task Schedule(网络流最..

评论

帐  号: 密码: (新用户注册)
验 证 码:
表  情:
内  容: