/* 给出一棵满二叉树的先序遍历,有两种节点:字母节点(A-Z,无重复)和空节点(#)。要求这个树的中序遍历。输出中序遍历时不需要输出#。 满二叉树的层数n满足1<=n<=5。 Sample Input: ABC#D#E Sample Output: CBADE */ #include<cstdio> #include<cmath> #include<cstring> #include<iostream> using namespace std; const int M=1024; char data[M]; int layer; struct node { char data; struct node *l; struct node *r; }; void build(node * & t,int l) { if(l>layer) return ; int i=0; while(data[i]=='