Recursive and iterative (DFS and BFS) in C++. Easy to understand.
Iterative in BFS:\n\n    bool isSymmetric(TreeNode root) {\n        if(!root) return true;\n        queue q;\n        q.push(make_pair(root->left, root->right))
**Iterative in BFS**:\n\n    bool isSymmetric(TreeNode* root) {\n        if(!root) return true;\n        queue<nodepair> q;\n        q.push(make_pair(root->left, root->right));\n        while(!q.empty()){\n            nodepair p = q.front();\n            q.pop();\n            if(!p.first && !p.second) continue;\n            if(!p.first || !p.second) return false;\n            if(p.first->val != p.second->val) return false;\n            q.push(make_pair(p.first->left, p.second->right));\n            q.push(make_pair(p.first->right, p.second->left));\n        }\n        return true;\n    }\n\n**Iterative in DFS**:\n\n    bool isSymmetric(TreeNode* root) {\n        if(!root) return true;\n        stack<TreeNode*> sl, sr;\n        sl.push(root);\n        sr.push(root);\n        TreeNode * lp = root->left, *rp = root->right;\n        while(lp || ! sl.empty() || rp || !sl.empty()){\n            if((!lp && rp) || (lp && !rp)) return false;\n            if(lp && rp){\n                if(lp->val != rp->val) return false;\n                sl.push(lp);\n                sr.push(rp);\n                lp = lp->left;\n                rp = rp->right;\n            }else{\n                lp = sl.top()->right;\n                rp = sr.top()->left;\n                sl.pop();\n                sr.pop();\n            }\n        }\n        return true;\n    }\n\n**Recursive**:\n\n    bool isSymmetric(TreeNode* root) {\n        if(!root) return true;\n        return helper(root->left, root->right);\n    }\n    bool helper(TreeNode* left, TreeNode* right){\n        if(!left && !right) return true;\n        if(!left || !right) return false;\n        return (left->val == right->val) && helper(left->left, right->right) && helper(left->right, right->left);\n    }
['Depth-First Search', 'Breadth-First Search', 'C++']