public static boolean isIdentical(BinaryTree root, BinaryTree root1){
if(root1==null && root==null)
return true;
else if(root1!=null && root!=null){
if(root1.value==root.value)
return(isIdentical(root1.left,root.left) && isIdentical(root1.right,root.right));
}
return false;
}
if(root1==null && root==null)
return true;
else if(root1!=null && root!=null){
if(root1.value==root.value)
return(isIdentical(root1.left,root.left) && isIdentical(root1.right,root.right));
}
return false;
}
No comments:
Post a Comment