#include#include #include using namespace std;typedef int ElemType;template int getArrayLength(T &array) { return (sizeof(array) / sizeof(array[0]));}typedef struct node{ ElemType data; struct node *lchild, *rchild;}*BST;bool insertBST(BST &T, ElemType element) { if (T == NULL) { T = new node; T->data = element; T->lchild = T->rchild = NULL; return true; } if (T->data == element) return false; if (element< T->data) insertBST(T->lchild, element); else insertBST(T->rchild, element);}//judgeint flag;void judge(BST T1, BST T2) { if (T1 == NULL && T2 == NULL) { return ; } else if(T1->data != T2->data) { //数据比较坑 flag = 0; return ; } else if(((T1->lchild !=NULL && T2->lchild !=NULL) || (T1->lchild ==NULL && T2->lchild ==NULL)) && ((T1->rchild !=NULL && T2->rchild !=NULL) || (T1->rchild ==NULL && T2->rchild ==NULL))) { //需要考虑全面 judge(T1->lchild, T2->lchild); judge(T1->rchild, T2->rchild); }else flag = 0;}int main() { int t, n ,k ,x; BST tree[25]; while (scanf("%d", &t)!=EOF && t) { memset(tree, 0, sizeof(tree)); for (int i=0; i