求结点在二叉排序树中层次的算法
1 typedef struct node{ 2 int key; 3 struct node *lchild,*rchild; 4 }bitree; 5 int lev=0; 6 void level(bitree *bt,int x) 7 { 8 if(bt!=null){ 9 lev++; 10 if(bt->key==x) return; 11 else if(bt->key>x) level(bt->lchild,x); 12 else level(bt->rchild,x); 13 } 14 }