就把这个题目当作建树的练手题了
代码如下
#include<stdio.h>
#include<malloc.h>
typedef struct node{
char data;
struct node* left;
struct node* right;
}Treenode,*NodeP;
char Pre[51],Mid[51];
int Position(char data,char Mid[],int n);
NodeP Insert(NodeP root,char data,int n)
{
if(!root){
//建立根节点
NodeP a = (NodeP)malloc(sizeof(Treenode