【PTA】树的同构 (25 分)

【PTA】树的同构 (25 分)_第1张图片

【PTA】树的同构 (25 分)_第2张图片

【PTA】树的同构 (25 分)_第3张图片

#include 
#include 
#define MAXN 10
using namespace std;

struct node
{
    char data;
    int lchild;
    int rchild;
}T1[MAXN],T2[MAXN];

void BulidT(node T[],int n){
    char l1,r1;
    for(int i=0;i>n1;
    scanf("%d",&n1);
    BulidT(T1,n1);
    //cin>>n2;
    scanf("%d",&n2);
    BulidT(T2,n2);
    
    root1=FindRoot(T1,n1);
    root2=FindRoot(T2,n2);

    if(Istonggou(root1,root2)) cout<<"Yes";
    else cout<<"No";
    
    return 0;
}

你可能感兴趣的:(PTA数据结构)