int level(BiTree bt,BSTNode *p){
int n=0;//counters
BiTree t=bt;
if(bt==NULL){
n++;
while(t->data!=p->data);
{
if(p->data < t->data)
t=t->lchild;
else
t=t->rchild;
n++;
}
}
return n;
}
二叉树采用二叉链表存储结构。在二叉排序树中,查找一次就下降一层,故查找次数即层次。