我看了书上的代码于是自己写了下,如下:
void leverorder(binarytreebt,queueq){
if(bt){
node*p;
p=bt->root;
inselem(q,p);
while(q->front!=q->rear){
front(q);
delelem(q);
if(p->lchild)
inselem(q,p->lchild);
if(p->rchild)
inselem(q,p->rchild);
}
destroy(q);
}
else
printf("this binarytree is null\n");
}