檢查兩個二叉樹的算法會是同構的嗎? 我的代碼 -在二叉樹中尋找同構性的算法
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