void LevleOrder(BiTree T)
{
/*层次遍历二叉树T，从第一层开始，每层从左到右*/
BiTree Queue[MAX],b; /*用一维数组表示队列，front和rear分别表示队首和队尾指针*/
int front,rear;
front=rear=0;
if (T) /*若树非空*/
{
Queue[rear++]=T; /*根结点入队列*/
while (front!=rear)
{   /*当队列非空*/
b=Queue[front++]; /*队首元素出队列，并访问这个结点*/
printf("%2c",b->data);
if (b->lchild!=NULL) Queue[rear++]=b->lchild; /*左子树非空，则入队列*/
if (b->rchild!=NULL) Queue[rear++]=b->rchild; /*右子树非空，则入队列*/
}
}
}/*LevelOrder*/

void Pre( bnode *b )
{
if(b != NULL)
{
printf(" %d", b->n);
Pre(b->lc);
Pre(b->rc);
}
}

bnode *CreateTree()
{
int data;
int front=1, rear=0;
bnode *root, *s;
root = NULL;

scanf("%d", &data);
while(data != -1)
{
s=NULL;
if(data != 0)
{
s = (bnode *)malloc(sizeof(bnode));
s->data = data;
s->lc = NULL;
s->rc = NULL;
}
rear++;

que[rear] = s;

if( rear == 1 )
{
root = s;
}
else
{
if( s&&que[front] )
{
if(rear%2 == 0)
{
que[front]->lc = s;
}
else
{
que[front]->rc = s;
}
}
if( rear %2 == 1 )
{
front++;
}
}
scanf("%d", &data);
}
return root;
}

bnode *Createtree()
{
bnode *p;
int data;

scanf("%d", &data);

if( data == 0 )
{
p = NULL;
}
else
{
p = (bnode *)malloc( sizeof(bnode) );
p->n = data;
p->lc = Createtree();
p->rc = Createtree();
}
return p;
}