#include<iostream>
using namespace std;
struct Btree
{
int data;
struct Btree *rchild,*lchild;
};
void Creattree (Btree *&t,int m)
{
if(t->data>=m)
{
if(t->lchild==NULL)
{
t->lchild=new Btree;
t->lchild->data=m;
t->lchild->lchild=NULL;
t->lchild->rchild=NULL;
}
else
Creattree(t->lchild,m);
}
else
{
if(t->rchild==NULL)
{
t->rchild=new Btree;
t->rchild->data=m;
t->rchild->lchild=NULL;
t->rchild->rchild=NULL;
}
else
Creattree(t->rchild,m);
}
}
void DLR(Btree *t)
{
if(t!=NULL)
{
DLR(t->lchild);
cout<<t->data<<" ";
DLR(t->rchild);
}
}
void Search(Btree *&t,int key)
{
if(t->data==key)
cout<<"找到这个数"<<endl;
else
{
if(t->data>key&&t->lchild!=NULL)
{
Search(t->lchild,key);
}
else if (key<t->data&&t->lchild==NULL)
{
t->lchild=new Btree;
t->lchild->data=key;