void BSTInsert( BSTree &T, BSTree s)
{
if(T==NULL)
T=s;
else if(s->data<T->data)
BSTInsert( T->lchild ,s);
else
BSTInsert( T->rchild ,s);
}
void BSTCreate(BSTree &T)
{
ElemType x; BSTree s;
T=NULL;
cin>>x;
while (x!=-1)
{
s=new BSTNode;
s->data=x;
s->lchild=s->rchild=NULL;
BSTInsert( T , s );
cin>>x;
}
}
BSTree BSTSearch(BSTree T, ElemType k)
{
if(!T || T->data==k )
return T ;
if(k<T->data)
return BSTSearch( T->lchild ,k);
else
return BSTSearch ( T->rchild ,k);
}