include<stdio.h>
include<stdlib.h>
define maxsize 100
typedef char TElemType;
typedef struct node{
TElemType data[maxsize];
TElemType n;
}SqBTree;
void createBinTree_Pre (SqBTree &T,TElemType pre[],int n,int &m){
TElemType ch=pre[m++];
if(ch==';') return;
if(ch!='#') {
T.data[n]=ch;
createBinTree_Pre(T,pre,n2+1,m);
createBinTree_Pre(T,pre,n2+2,m);
}
}
void CreatEmptyTree(SqBTree &T){
for(int i = 0;i<maxsize;i++){
T.data[i] = '#';
}
}
void PrintBinTree(SqBTree &t,int n) {
if(t.data[n]!='#'){
printf("%c",t.data[n]);
printf("(");
PrintBinTree(t,n2+1);
printf(",");
PrintBinTree(t,n2+2);
printf(")");
}
}
int main(){
int n=0,m=0;
TElemType ch[]={'A','B','C','#','#','D','#','E','#','#','#',';'};
SqBTree T;
CreatEmptyTree(T);
createBinTree_Pre(T,ch,n,m);
PrintBinTree(T,n);
return 0;
}