新二叉树
#include<bits/stdc++.h>
using namespace std;
struct node
{
char lc,rc,fa;
};
node tree[1000];
void work(char s)
{
cout<<s;
if(tree[s].lc!='*')work(tree[s].lc);
if(tree[s].rc!='*')work(tree[s].rc);
}
int main()
{
int n;
char fir;
cin>>n;
for(int i=1;i<=n;i++)
{
char s;
scanf(" %c",&s);
if(i==1)fir=s;
scanf(" %c%c",&tree[s].lc,&tree[s].rc);
tree[tree[s].lc].fa=tree[tree[s].rc].fa=s;
}
work(fir);
return 0;
}