Skip to content

Latest commit

 

History

History
26 lines (19 loc) · 593 Bytes

File metadata and controls

26 lines (19 loc) · 593 Bytes
bool check(struct Node* r1,struct Node* r2)
    {
        if(!r1 && !r2) return true;
        
        if(!r2 || !r2) return false;
        
        if(r1->data!=r2->data) return false;
        
        bool l = check(r1->left,r2->right);
        if(!l) return false;
        
        bool r = check(r1->right,r2->left);
        return r;
    }
    bool isSymmetric(struct Node* root)
    {
	 
	    if(!root)
	        return true;
	       
	   return check(root->left,root->right);
    }