typedef struct CSNode
{
ElemType data;
struct CSNode *fch,*nsib;
}CSNode,*CSTree;
int Height(CSTree T)
{
int hc,hs;
if(T==NULL)
return 0;
else
{
hc=height(T->fch);
hs=height(T->nsib);
if(hc+1>hs)
return hc+1;
else
return hs;
}
}
typedef struct
{
PTNode nodes[Max];
int n;
}PTree;
int Height(PTree T) {
int i,j;
int h;
int max = 0;
for (i=0; i<T.n; i++) { //比较每个结点的深度
h=0;
for (j=i; j>-1; j=T.nodes[j].parent)
h++;
if (h>max)
max=h;
}
return max;
}