boolean areMirrors(BinaryTreeNode root1,BinaryTreeNode root2){
if(root1 == null && root2 == null)
return true;
if(root1 == null || root2 == null)
return false;
if(root1.getData() != root2.getData())
return false;
else
return areMirrors(root1.getLeft(),root2.getRight())
&& areMirrors(root1.getRight(),root2.getLeft());
};
Given two trees, judge whether they are mirror images of each other
Guess you like
Origin blog.csdn.net/weixin_37632716/article/details/114599654
Recommended
Ranking