Description: #include <stdio.h>
#include <stdlib.h>
typedef struct BTnode
{
char data
struct BTnode*lchild,*rchild
}BTNode
#define NodeLen sizeof(BTNode)
BTNODE*Creat_Bt(void)
void Preorder(BTNode*bt)
void Inorder(BTNode*bt)
int count,deep
main()
{
BTNode*t
char s[10]
for( )
{
printf("1----------建立二叉树
2----------先中根遍历二叉树\n
3----------求叶子数和树深
4----------退出\n)
gets(s)
switch(*s)
{
case 1 :t=Creat_Bt() break
case 2 :Preorder(t) printf("\n") break
case 3 :count=deep=0
Leafs_deep(t,0) printf("\n叶子结点数: d\n"count) printf("树深: d\n",deep) break
case 4 :exit(0)
}
}
To Search:
File list (Check if you may need any files):
include.doc