给出二叉树的先根,中根遍历,求其后根遍历
我的做法,先找跟,中根遍历的顺序表中第一个在先跟遍历出现的节点是跟,跟左边的节点构成左子树,右边右子树,然后递归此方法用于左右子树。
建树完成后后跟输出即可。
#include
#include
#include
using namespace std;
const int maxn=101;
char a[maxn],b[maxn];
int lon;
struct
{
}tr[1001];
int lona,lonb;
int built(int t,int st,int en)
{
//
printf("%d %d\n",st,en);
}
int prin(int t)
{
}
int main()
{
}