{int num=
BiTree s[]; //s是棧
whlie(bt!=null || top>
{while(bt!=null) {push(s
if(!StackEmpty(s))
{bt=pop(s)
bt=bt
}
} return(num);
}//結束Count
int LeafKlevel(BiTree bt
{if(bt==null || k<
BiTree p=bt
int front=
int last=
while(front<=rear)
{p=Q[++front];
if(level==k && !p
if(p
if(p
if(front==last) {level++; //二叉樹同層最右結點已處理
last=rear; } //last移到指向下層最右一元素
if(level>k) return (leaf); //層數大於k 後退出運行
}//while }//結束LeafKLevel
[
From:http://tw.wingwit.com/Article/program/sjjg/201311/23712.html