C++ | Recursive | Well Commented
\nclass Solution {\npublic:\n    bool solve(TreeNode * r1, TreeNode * r2)\n    {    \n        if(r1 == NULL && r2 == NULL)\n            return true; \n\t\t\n   
```\nclass Solution {\npublic:\n    bool solve(TreeNode * r1, TreeNode * r2)\n    {    \n        if(r1 == NULL && r2 == NULL)\n            return true; \n\t\t\n        else if(r1 == NULL || r2 == NULL || r1->val != r2->val)\n            return false; \n        \n        return solve(r1->left, r2->right) && solve(r1->right, r2->left);\n    }\n    \n    bool isSymmetric(TreeNode* root) \n    {\n        return solve(root->left, root->right);     \n    }\n};\n```\n\nExplanation :\n\n```\nclass Solution {\npublic:\n    bool solve(TreeNode * r1, TreeNode * r2)\n    {\n        // See the tree diagram are r1 and r2 null ? No, so this line dont execute\n        if(r1 == NULL && r2 == NULL)\n            return true; \n\t\t\n        // Is any one of r1 or r2 null ? Or are these values different ? No. Both values are\n        // same so this else if wont execute either\n        else if(r1 == NULL || r2 == NULL || r1->val != r2->val)\n            return false; \n        \n        // Now comes the main part, we are calling 2 seperate function calls \n        return solve(r1->left, r2->right) && solve(r1->right, r2->left);\n        // First solve() before && will execute\n        // r1->left is 3 and r2->right = 3\n        // Both values are same , they will by pass both if and else if statement\n        // Now again r1->left is null and r2->right is null\n        // So they will return true from first if condtion\n        // Now the scene is : we have executed first solve() before && and it has\n        // returned us True so expression becomes \' return true && solve() \'\n        // Now solve after && will execute \n        // Similarly it will check for 4 and 4 , it will by pass if else statements\n        // next time both will become null, so will return true\n        // Thus 2nd solve() at the end will also hold true\n        // and we know \'true && true\' is true\n        // so true will be returned to caller, and thus tree is mirror of itself.\n        // Similarly you can check for any testcase, flow of execution will remain same.\n        \n    }\n    \n    bool isSymmetric(TreeNode* root) \n    {\n        // Imagine a tree:    1\n        //                 2     2\n        //               3   4 4   3\n        // We are standing on root that is 1, function begins\n        // and now r1 and r2 points to 2 and 2 respectively.                      \n        return solve(root->left, root->right);     \n    }\n};\n```
['Recursion', 'C', 'C++']