首页 > 代码库 > 已知二叉树的先序遍历序列和中序遍历序列,输出该二叉树的后序遍历序列

已知二叉树的先序遍历序列和中序遍历序列,输出该二叉树的后序遍历序列

题目描述
输入二叉树的先序遍历序列和中序遍历序列,输出该二叉树的后序遍历序列。
输入
第一行输入二叉树的先序遍历序列;
第二行输入二叉树的中序遍历序列。
输出
输出该二叉树的后序遍历序列。
示例输入
ABDCEF
BDAECF
示例输出
DBEFCA
#include <iostream>
#include <cstring>
#define MAX 50+3
using namespace std;
typedef char Elem_Type;
typedef struct BiTree
{
    Elem_Type data;//数据
    struct BiTree *Lchild;//左孩子
    struct BiTree *Rchild;//右孩子
}BiTree;      //要查找的元素  查找的地方    数组的长度
int Search_Num(Elem_Type num,Elem_Type *array,int len)
{
    for(int i=0; i<len; i++)
       if(array[i] == num)
         return i;
    //return -1;//没有找到
}                     //前序遍历         中序遍历   中序数组长度
BiTree *Resume_BiTree(Elem_Type *front,Elem_Type *center,int len)
{
    if(len <= 0)
      return NULL;
    BiTree *temp = new BiTree;
    temp->data = http://www.mamicode.com/*front;>