//and the output of the binary tree and high order sequence, after the first line is the number of sets of test data of N,
//behind for N group test data, and then the output after height and sequence arrangement,
# include
# include
using namespace std;
Const int maxsize=100;
Struct tree {
Char data;
Tree * rchild;
Tree * lchild;
};
//binary tree to create
Tree * creatBtree ()
{
}
//before order
Void qianxu (tree * Node)
{
If (Node==NULL)
return;
Qianxu (Node - & gt; Lchild);
Qianxu (Node - & gt; Rchild);
Cout & lt;
//destruction
Void xiaohui (tree * root)
{
If (root==NULL)
return;
Xiaohui (root - & gt; Lchild);
Xiaohui (root - & gt; Rchild);
Delete the root;
}
//the main function
Int main ()
{
Root tree *=NULL;
Int N;//set number
Char qianxu [maxsize];//before order
Char zhongxu [maxsize];//in order
Cin & gt;> N;//number of sets of input
Cin & gt;> Qianxu> & gt;" "& gt;> Zhongxu;//input sequence and the sequence of binary tree before
Int len=strlen (qianxu) - 1;
Root=creatBtree ();
Xiaohui (root);
}