#include
#include
#define MaxSize 50
#define MaxWidth 30
typedef struct BiTNode{
char data;
struct BiTNode *lchild,*rchild;
}BiTNode,*BiTree;
BiTree createbitree(BiTree &T)
{
char ch;
ch=getchar();
if(ch=='0')
T=NULL;
else
{
T=(BiTNode *)malloc(sizeof(BiTNode));
T->data=ch;
T->lchild=createbitree(T->lchild);
T->rchild=createbitree(T->rchild);
}
return T;
}
void visit(char ch)
{
printf("%c",ch);
}
void preordertraverse(BiTree T)
{
if(T)
{
visit(T->data);
preordertraverse(T->lchild);
preordertraverse(T->rchild);
}
}
void inordertraverse(BiTree T)
{
if(T)
{