Create 是否是完全二叉树.cpp

This commit is contained in:
hao14293
2019-07-25 16:24:50 +08:00
committed by GitHub
parent fe9efd6ea2
commit fa2ee43ab6

View File

@@ -0,0 +1,19 @@
bool IsComplete(BiTree T){
InitQueue(Q);
if(!T) return 1;
EnQueue(Q, T);
while(!IsEmpty(Q)){
DeQueue(Q, p);
if(p){
EnQueue(Q, p->lchild);
EnQueue(Q, p->rchild);
}
else{
while(!IsEmpty(Q)){
DeQueue(Q, p);
if(p) return 0;
}
}
}
return 1;
}