如何判断一棵树是否为完全二叉树?
如何判断一棵树是否为完全二叉树?

EnQueue(Q, root); while(!EmptyQueue(Q)) { DeQueue(Q, &a); if (a->r && !a->l) { Destroy(Q);return 0;//不是完全二叉树 } if (a->l) EnQueue(Q, a->l); if (a->r) EnQueue(Q, a->r); } return 1;
临时敲得,也许有遗漏,大致如此了