typedef char Etype; //定义二叉树结点值的类型为字符型
typedef struct BiTNode //树结点结构
{
Etype data;
struct BiTNode *lch,*rch;
}BiTNode,*BiTree;
BiTree que[M];
int front=0,rear=0;
//函数原型声明
BiTNode *creat_bt1();
BiTNode *creat_bt2();
void preorder(BiTNode *p);
void inorder(BiTNode *p);
void postorder(BiTNode *p);
void enqueue(BiTree);
BiTree delqueue( );
void levorder(BiTree);
int treedepth(BiTree);
void prtbtree(BiTree,int);
void exchange(BiTree);
int leafcount(BiTree);
void paintleaf(BiTree);
BiTNode *t;
int count=0;
//主函数
void main()
{
char ch;
int k;
do{
printf("\n\n\n");
printf("\n===================主菜单===================");
printf("\n\n 1.建立二叉树方法 1");
printf("\n\n 2.建立二叉树方法 2");
printf("\n\n 3.先序递归遍历二叉树");
printf("\n\n 4.中序递归遍历二叉树");
printf("\n\n 5.后序递归遍历二叉树");
printf("\n\n 6.层次遍历二叉树");
printf("\n\n 7.计算二叉树的高度");
printf("\n\n 8.计算二叉树中叶结点个数");
printf("\n\n 9.交换二叉树的左右子树");
printf("\n\n 10.打印二叉树");
printf("\n\n 0.结束程序运行");
printf("\n============================================");
评论0
最新资源