BiTree Search(BiTree bt,elemtype x) |
{ /*在bt 为根结点指针的二叉树中查找数据元素x*/ |
BiTree p; |
if (bt->data==x) return bt; /*查找成功返回*/ |
if (bt->lchild!=NULL) return (Search(bt->lchild,x)); |
/*在bt->lchild 为根结点指针的二叉树中查找数据元素x*/ |
if (bt->rchild!=NULL) return (Search(bt->rchild,x)); |
/*在bt->rchild 为根结点指针的二叉树中查找数据元素x*/ |
return NULL; /*查找失败返回*/ |
} |