struct node {
int val;
node *left, *right;
};
bool isSame(node *a, node *b) {
if (!a && !b) return true;
if ((!a && b) || (!b && a)) return false;
if (a->val == b->val)
return isSame(a->left, b->left) && isSame(a->right, b->right);
else return false;
}
判断两棵二叉树是否相同
猜你喜欢
转载自blog.csdn.net/ASJBFJSB/article/details/102852152
今日推荐
周排行