bool visit(node temp1, node temp2) { if(temp1.left==null && temp2.right==null) return true; else if((temp1.left==null && temp2.right!=null) || (temp1.left!=null && temp2.right==null)) return false; else return visit(temp1.left,temp2.right);
-- do the same for temp1.right and temp2.left } Just check whether root. left and root.right are not null and pass it the visit function. -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.