SDUTOJ 2482 二叉排序樹
#include
#include
using namespace std;
char c[100],d[100];
int o=0,e=0;
typedef struct bitnode
{
char data;
struct bitnode *lchild,*rchild;
}bitnode,*bitree;
void insert(bitree &t1,char key)
{
if(t1==NULL)
{
t1=new bitnode;
t1->lchild=t1->rchild=NULL;
t1->data=key;
return ;
}
else
{
if(keydata)
insert(t1->lchild,key);
else
insert(t1->rchild,key);
}
}
void preorder(bitree t)
{
if(t!=NULL)
{
c[o++]=t->data;
preorder(t->lchild);
preorder(t->rchild);
}
}
void postorder(bitree t3)
{
if(t3!=NULL)
{
postorder(t3->lchild);
postorder(t3->rchild);
d[e++]=t3->data;
}
}
int main()
{
char a[100],b[100];
int n,len,i;
bitree t1;
while(cin>>n)
{
if(n==0)
{
break;
}
t1=NULL;
cin>>a;
len=strlen(a);
for(i=0;i>b;
if(strcmp(a,b)==0)
cout<<"YES"<