/
*
文件名称:main.cpp
作者 :王超
完成日期:2015年11月9日
问题描述:二叉树的构造
*/
#include <stdio.h>
#include <malloc.h>
#include "btree.h"
int main()
{
ElemType pre[]="ABDGCEF",in[]="DGBAECF";
BTNode *b1;
b1=CreateBT1(pre,in,7);
printf("b1:");
DispBTNode(b1);
printf("\n");
ElemType p[]="DGBAECF",post[]="GDBEFCA";
BTNode *b2;
b2=CreateBT2(post,in,7);
printf("b2:");
DispBTNode(b2);
printf("\n");
return 0;
}
#include <malloc.h>
#include "btree.h"
BTNode *CreateBT1(char *pre,char *in,int n)
/*pre存放先序序列,in存放中序序列,n为二叉树结点个数,
本算法执行后返回构造的二叉链的根结点指针*/
{
BTNode *s;
char *p;