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");
}