//这里用到了STL……
typedef struct btnode{
char data;
struct btnode *lchild;
struct btnode *rchild;
}BTnode,*BiTree;
bool fulltree(BiTree T){
if(T!=NULL){
queue<BiTree> q;
q.push(T);
while(!q.empty()){
BiTree temp=q.front();
if(temp->lchild!=NULL&&temp->rchild!=NULL){
q.pop();
q.push(temp->lchild);
q.push(temp->rchild);
}
if(temp->lchild==NULL&&temp->rchild!=NULL) return false;
if((temp->lchild!=NULL&&temp->rchild==NULL)||(temp->lchild==NULL&&temp->rchild==NULL)){
q.pop();
while(!q.empty()){
temp=q.front();
if(temp->lchild==NULL&&temp->rchild==NULL) q.pop();
else return false;
}
return true;
}
}
return true;
}
else return false;
}