能不能写个主程序啊,越简单越好,谢谢咯~~~~
追答应该知道二叉树怎么建立吧,我就不写了哈
typedef struct TreeNode{
int data;
TreeNode *left;
TreeNode *right;
}TreeNode,*Tree;
void first(Tree *root)
{
printf("%d ",root->data);
first(root->left);
first(root->right);
}
void mid(Tree *root)
{
mid(root->left);
printf("%d ",root->data);
mid(root->right);
}
void last(Tree *root)
{
last(root->left);
last(root->right);
printf("%d ",root->data);
}
main ()
{
Tree t1;
CreateTree(t1);//生成一棵二叉树,参考数据结构
printf("先序遍历序列:\n");
first(t1);
printf("中序遍历序列:\n");
mid(t1);
printf("后续遍历序列:\n");
last(t1);
}
谢谢~
追答那么,采纳一个呗,嘿嘿
本回答被提问者采纳