Share 3 methods to solve this problem  (Java)
First.\nWe can define a binary tree by mid-order and post-order or pre-order and mid-order, the mirror tree is same to the origin tree. So we can check these tw
First.\nWe can define a binary tree by mid-order and post-order or pre-order and mid-order, the mirror tree is same to the origin tree. So we can check these two trees' mid-order and post-order are all same?\n\n    public boolean isSymmetric(TreeNode root) {\n            if (root==null)\n                return true;\n            return getMidOrderSeq(root).equals(getReMidOrderSeq(root))&&getPostOrderSeq(root).equals(getRePostOrderSeq(root));\n        }\n    \n        public String getMidOrderSeq(TreeNode node) {\n            if (node == null) {\n                return "";\n            }\n            return getMidOrderSeq(node.left) + node.val + getMidOrderSeq(node.right);\n        }\n        public String getReMidOrderSeq(TreeNode node) {\n            if (node == null) {\n                return "";\n            }\n            return getReMidOrderSeq(node.right) + node.val + getReMidOrderSeq(node.left);\n        }\n        public String getPostOrderSeq(TreeNode node) {\n            if (node == null) {\n                return "";\n            }\n            return getPostOrderSeq(node.left) +getPostOrderSeq(node.right)+ node.val ;\n        }\n        public String getRePostOrderSeq(TreeNode node) {\n            if (node == null) {\n                return "";\n            }\n            return getRePostOrderSeq(node.right) +getRePostOrderSeq(node.left)+ node.val ;\n        }\n\n\nSecond. Normal recursion.\n\n     public boolean isSymmetric(TreeNode root) {\n            if (root == null)\n                return true;\n            return isSymmetric(root, root);\n    \n        }\n    \n        public boolean isSymmetric(TreeNode left, TreeNode right) {\n            if (left == null || right == null) {\n                return left == right;\n            }\n            return left.val == right.val && isSymmetric(left.left, right.right) && isSymmetric(left.right, right.left);\n        }\n\nThird. Iteration.\n\n    public boolean isSymmetricIter(TreeNode root) {\n            if (root == null || (root.left == null && root.right == null))\n                return true;\n            Stack<TreeNode> leftStack = new Stack<>();\n            Stack<TreeNode> rightStack = new Stack<>();\n            leftStack.push(root.left);\n            rightStack.push(root.right);\n            while (!leftStack.isEmpty() && !rightStack.isEmpty()) {\n                TreeNode left = leftStack.pop();\n                TreeNode right = rightStack.pop();\n                if (left == null && right == null) {\n                    continue;\n                }\n                if (left == null || right == null)\n                    return false;\n                if (left.val != right.val)\n                    return false;\n                leftStack.push(left.left);\n                rightStack.push(right.right);\n                leftStack.push(left.right);\n                rightStack.push(right.left);\n            }\n            return true;\n        }
['Java']