int Depth(Ptree t) //求以雙親表示法為存儲結構的樹的深度
{int maxdepth=
for(i=
{temp=
while(f>
if(temp>maxdepth) maxdepth=temp; //最大深度更新
}
return(maxdepth);//返回樹的深度
} //結束Depth
int Height(btre bt)//求二叉樹bt的深度
{int hl
if (bt==null) return(
else {hl=Height(bt
if(hl>hr) return (hl+
} }
[
From:http://tw.wingwit.com/Article/program/sjjg/201311/23725.html