struct BTNode*CreateBT(int* pre,int* in,int n){struct BTNode* s =NULL;int k =0,*p =NULL;if(n<=0){returnNULL;}
s =(struct BTNode *)malloc(sizeof(struct BTNode));
s->data =*pre;for(p = in; p <(in + n); p++){if(*p ==*pre){break;}}
k = p - in;
s->lchild =CreateBT(pre+1, in, k);
s->rchild =CreateBT(pre+k+1, p+1, n-k-1);return s;}
中序序列+后序序列
struct BTNode*CreateBT(int* post,int* in,int n){struct BTNode* s =NULL;int k =0,*p =NULL, r =0;if(n <=0){returnNULL;}
r =*(post + n -1);
s =(struct BTNode *)malloc(sizeof(struct BTNode));
s->data = r;for(p = in; p <(in + n); p++){if(*p == r){break;}}
k = p - in;
s->lchild =CreateBT(post, in, k);
s->rchild =CreateBT(post+k, p+1, n-k-1);}
二叉树的构建前序序列+中序序列struct BTNode* CreateBT(int* pre, int* in, int n) { struct BTNode* s = NULL; int k = 0, *p = NULL; if (n<=0) { return NULL; } s = (struct BTNode *)malloc(sizeof(struct BTNode)); s->data = *pre; for