1. This can done easily using recursive method. Here is complete function .
//check to binary tree is identical static bool isBinaryTreeIdentical(treeNode *rootNode1, treeNode *rootNode2) { if (rootNode1 == NULL && rootNode2 == NULL) return true; else if (rootNode1 == NULL || rootNode2 == NULL) return false; else return (rootNode1->val == rootNode2->val && isBinaryTreeIdentical(rootNode1->leftChild, rootNode2->leftChild) && isBinaryTreeIdentical(rootNode1->rightChild, rootNode2->rightChild)); } };
above mention function is member function of my Tree ADT class you can check complete program here
A Developer
Gy@n!