# Symmetric Tree

1. 问题

Given a binary tree, check whether it is a mirror of itself (ie, symmetric around its center).

For example, this binary tree is symmetric:

    1
/ \
2   2
/ \ / \
3  4 4  3


But the following is not:

    1
/ \
2   2
\   \
3    3

2. 解答
bool isSymtotree(struct TreeNode *root1,struct TreeNode *root2)
{
if(root1==NULL && root2==NULL) return true;
if(root1==NULL && root2!=NULL) return false;
if(root1!=NULL && root2==NULL) return false;

if(root1->val==root2->val)
{
return isSymtotree(root1->left,root2->right)&&isSymtotree(root1->right,root2->left);
}
return false;
}
bool isSymmetric(struct TreeNode* root)
{
if(root==NULL) return true;
//struct TreeNode *root1=invertTree(root);
//return isSameTree(root,root1);
return isSymtotree(root->left,root->right);
}

#### LeetCode(101)Symmetric Tree

2014-01-17 06:48:54

#### Leetcode-Symmetric Tree——判断二叉树是否对称

2014-04-20 01:00:22

#### Symmetric Tree -- LeetCode

2014-04-07 04:52:23

#### 【LeetCode】101. Symmetric Tree 解题报告

2016-05-30 23:06:35

#### 101. Symmetric Tree Leetcode Python

2015-01-30 07:28:30

#### 【leetcode c++】101 Symmetric Tree

2015-07-27 14:39:02

#### 【LeetCode-面试算法经典-Java实现】【101-Symmetric Tree（对称树）】

2015-08-07 07:29:25

#### leetcode 101. Symmetric Tree 判断对称树,递归和迭代

2016-04-30 21:23:13

#### 101. Symmetric Tree [easy] (Python)

2016-06-03 15:53:34

#### Leetcode Symmetric Tree 递归和非递归解法

2014-02-16 01:11:36