class Solution {

public:

```
bool isSymmetric(TreeNode* root) {
TreeNode * r1=root,*r2=root;
return is_sym(r1,r2);
}
bool is_sym(TreeNode *r1,TreeNode *r2)
{
if(r1==NULL && r2==NULL)
return true;
if(r1==NULL || r2==NULL)
return false;
if(r1->val != r2->val)
return false;
return (is_sym(r1->left,r2->right) && is_sym(r1->right,r2->left));
}
```

};