int Height(BiTree bt)//求二叉樹bt的深度
{int hl
if (bt==null) return(
else {hl=Height(bt
if(hl>hr) return (hl+
} }// Height
void Balance(BiTree bt)
//計算二叉樹bt各結點的平衡因子
{if (bt)
{Balance(bt
Balance(bt
hl=Height(bt
bt
} }//算法結束
void Traverse(BiTree bt
// 求二叉樹bt的順序存儲結構A[
{BiTree A[]
if(bt!=null)
{int front=
while(front<=rear)
{p=A[++front]; if(p) last=front; // 出隊;用last記住最後一個結點的下標
rear=
if (p) //二叉樹的實際結點
{if(rear>n) printf(
if(rear+
}
else //p是虛結點
{ if(rear<=n) A[rear]=null; if(rear+
}// while(front<=rear)
printf(
}//if(bt!=null) }//Traverse
[
From:http://tw.wingwit.com/Article/program/sjjg/201311/23707.html