Description
给定先序序列,按照该序列创建对应的二叉树,并输出其中序和后序序列。
Input
一行,二叉树按先序遍历序列,空指针用字符^占位
Output
两行,分别对应该二叉树的中序和后序序列
Sample Input
ABC^DEG^F^^
Sample Output
CBEGDFA
CGEFDBA
#include<malloc.h>
#include<stdio.h>
#define TElemType char
//二叉树的二叉链表的表示与实现
typedef struct BiTNode{
TElemType data;
struct BiTNode *lchild,*rchild;
}BiTNode,*BiTree;
//先序遍历
void PreOrderTarverse(BiTree T,void (*visit)(TElemType))
{
if(T)