public boolean structurallyIdentical(BinaryTree other) {
return this.structurallyIdentical(this.root, other.root);
}
private boolean structurallyIdentical(Node tnode, Node onode) {
if(tnode==null && onode==null){
return true;
}
if(tnode!=null && onode!=null){
return (tnode.data==onode.data && structurallyIdentical(tnode.left,onode.left) && structurallyIdentical(tnode.right,onode.right));
}else{
return false;
}
}