检查两个二叉树的算法会是同构的吗? 我的代码 -在二叉树中寻找同构性的算法
boolean isIsomorphic(Root t1 , Root t2){
if(t1==null || t2==null){
return false;
}
if((t1.value == t2.value) && (isIsomorphic(t1.left,t2.right) && isIsomorphic(t1.right,t2.left))) {
return true
}
return false;
}
请正确定义树的同构,或者引用一个定义。 – amit 2012-04-27 15:43:23