总是无法实现层序遍历不知道问题出在哪了。
bool Enqueue(Linkqueue &Q,TNode *e)
{
TNode *s=(TNode*)malloc(sizeof(TNode));
s=e;
s->next=Q.rear->next;
Q.rear->next=s;
Q.rear=s;
}
bool Dequeue(Linkqueue &Q,TNode *e)
{
e=Q.front->next;
Q.front=Q.front->next;
}
bool Levelorder(Bitree T,Linkqueue Q)
{
if(T!=NULL)
Enqueue(Q,T);
TNode *e;
while(Q.front!=Q.rear)
{
Dequeue(Q,e);
printf("结点值:%d\n",e->data);
if(e->lchild!=NULL)
Enqueue(Q,e->lchild);
if(e->rchild!=NULL)
Enqueue(Q,e->rchild);
}
}
https://www.cnblogs.com/leaves1024/p/12831376.html