2007-d-二

typedef struct BTNode
{
    int data;
    int b;//平衡因子
    struct BTNode *lchild;
    struct BTNode *rchild;
} BTNode;

int getDepth(BTNode *T)
{
    int level=0;
    BTNode *p;
    p=T;
    while(p!=NULL)
    {
        ++level;
        if(p->b<0) p=p->rchild;//右子树高
        else p=p->lchild;//左子树高
    }
    return level;
}