//知道后序和中序,构建二叉树#include <>#define MAX_NODE_NUM (100)typedef struct Node{ char id; struct Node* pLeft; struct Node* pRight;} Node;typedef struct{ Node* Elem[MAX_NODE_NUM]; int top;}NodeStack;Node* pTree=NULL;Node* MakeTree(char* pInorder, char* pPostOrder, int nNode){ char root; int i; if(nNode==0) return NULL; root =pPostOrder[nNode-1]; i=strchr(pInorder,root); root-='A'; pTree[root].pLeft=MakeTree(pInorder,pPostOrder,i); pTree[root].pRight=MakeTree(pInorder+i+1,pPostOrder+i,nNode-1-i); return &pTree[root];}void visit(Node* pNode){ putchar(pNode->id);}void PreOrderUnrec(Node* pRoot){ Node* p=pRoot; NodeStack s; ; while (p!=NULL || ) { while (p!=NULL) //遍历左子树 { visit(p); [++]=p; // push p=p->pLeft; } if () { p=[]; // pop p=p->pRight; } }}int main(){ char inorder[MAX_NODE_NUM]; char postorder[MAX_NODE_NUM]; int i=0,nNode=0; Node* pRoot=NULL; inorder[0]=0; postorder[0]=0;__START: printf("Please input number of node:"); scanf("%d",&nNode); if(nNode<=0) { printf("Invalid input.\n"); goto __START; } pTree = (Node*)malloc(nNode*sizeof(Node)); for(i=0;i