结构推理 试设计一算法,求出指定结点在给定的二叉排序树中所在的层次。
【正确答案】int countlevel(BSTNODE*root,BSTNODE*p)
   {  int leve1=0;
       if(root==NULL)
           return 0;
       else
       { level++;
           while(root->key!=p->key)
           { if(root->key<p->key)
                   root=root->rchild;
               else
                   root=root->lchild;
               level++;
           }
           return level;
       }
   }
【答案解析】