int Height(TNode *r)
{
int h1,h2;
if(r==NULL)
return 0;
else{
h1=Height(r->lchild);
h2=Height(r->rchild);
if(abs(h1-h2)>1)
flag=1;
return 1+(h1>h2?h1:h2);
}
}
void main()
{
TNode *r;
int height;
char post[MAX],in[MAX];
printf("Input inorder and postorder :/n");
gets(in);
gets(post);
MkTree(in,0,strlen(in)-1,post,0,strlen(post)-1,&r);
printf("The preorder is as follows:/n");
preorder(r);
printf("/nThere are %dletters in the tree./n",leaf(r));
count=0;
BNode(r);
printf("/nThere are %d binarynode in the tree./n",count);
flag=0;
height=Height(r);
printf("/nThe height of the tree is %d/n",height);
if(flag==1)
printf("/nThis bintree is not an AVL!/n");
else
printf("/nThis bintree is an AVL!/n");
}