#include<stdio.h>
#include<stdlib.h>
typedef struct Bitnode{
char data;
struct Bitnode *lchild,*rchild;
}Bitnode,*Bitree;
void creatBitree(Bitree &t){
char ch;
scanf("%c",&ch);\
if(ch=='#')t=NULL;
else{
t=(Bitnode*)malloc(sizeof(Bitnode));
t->data=ch;
creatBitree(t->lchild);
creatBitree(t->rchild);
}
}
void zhongxu(Bitree &t){
if(t){
zhongxu(t->lchild);
printf("%c",t->data);
zhongxu(t->rchild);
}
}
void houxu(Bitree &t){
if(t){
houxu(t->lchild);
houxu(t->rchild);
printf("%c",t->data);
}
}
int judge(Bitree t){
if(!(t))return 0;
else{
if(judge(t->lchild)==judge(t->rchild))return 1;
else return 0;
}
}
void main () {
Bitree T;
the printf ( "first-order input: \ n-");
creatBitree (T);
the printf ( "in order output: \ n-");
zhongxu (T);
the printf ( "\ n-");
printf ( "the order output: \ n-");
houxu (T);
printf ( "\ n-");
printf ( "is positive the binary tree \ n-");
iF (Judge (T))
printf ( "Yes \ n- ");
the else
the printf (" NO \ n-");
}