- Binary Tree, Inorder Traversal, Recursion, Tree, tree-traversal

Convert given Binary Tree to Symmetric Tree by adding minimum number of nodes

  #include using namespace std;  class Node {public:    int val;    Node *left, *right;    Node(int val)    {        this->val = val;        left = right = NULL;    }};  Node* buidSymmetericTree(Node* root1,                         Node* root2){        if (root1 == NULL and root2 == NULL) {        return NULL;    }          if (root1 == NULL) {                          Node* node = new Node(root2->val);        root1 = node;    }          if (root2 == NULL) {                          Node* node = new Node(root1->val);        root2 = node;    }                  if (root1->val != root2->val) {        int temp = root1->val + root2->val;        root1->val = temp;        root2->val = temp;    }          root1->left        = buidSymmetericTree(            root1->left, root2->right);          root1->right        = buidSymmetericTree(            root1->right, root2->left);          return root1;}  void inorder(Node* root){        if (root == NULL)        return;      inorder(root->left);    cout val right);}  int main(){    Node* root = new Node(3);    root->left = new Node(2);    root->right = new Node(4);    root->left->left = new Node(5);              buidSymmetericTree(root, root);          inorder(root);      return 0;}