#include
#include
using namespace std;
Typedef struct bTree {
Char data;
LCH struct bTree * and * RCH;
} bTree;
Creat bTree * * p) (bTree {
Char c;
The scanf (" % c ", & amp; C);
If (c==' ')
P=NULL;
The else {
P=(bTree *) malloc (sizeof (bTree));
p-> Data=https://bbs.csdn.net/topics/c;
p-> LCH=creat (p - & gt; LCH);
p-> RCH=creat (p - & gt; RCH);
}
return p;
}
//in order o
Void printMid (bTree * p) {
If (p) {
PrintMid (p - & gt; LCH);
Cout
PrintMid (p - & gt; RCH);
}
}
//determine binary tree T1, T2 is similar, is to return true, no returns false
Bool SimilarTree (bTree * T1, bTree * T2) {
if(! T1) {//T1 is empty tree
if(! T2)
return true;//T2 is empty tree
The else
return false;
}
The else {//T1 is empty tree
if(! T2) return false.
The else {//T2 non-null tree
If (SimilarTree (T1 - & gt; LCH, T2 - & gt; LCH) & amp; & SimilarTree (T1 - & gt; RCH, T2 - & gt; RCH))
return true;
The else
return false;
}
}
}
Int main () {
BTree * B1=NULL, * B2=NULL;
Cout<" B1: build a binary tree "& lt;
Cout<" B2: build binary tree "& lt;
Cout<" Please make sure you enter information: "& lt;
PrintMid (B1);
Cout
Cout
Cout<" B1, B2 is similar to the binary tree "& lt;
Cout<" B1, B2 is not similar to the binary tree "& lt;
}