Skip to content

Latest commit

 

History

History
32 lines (22 loc) · 729 Bytes

File metadata and controls

32 lines (22 loc) · 729 Bytes
vector<int>v1,v2;
    
    bool inorder(Node* r1 ,Node* r2)
    {
        if(r1==NULL && r2==NULL)
            return true;
        
        if(!r1 || !r2)
            return false;
            
        if(r1->data!=r2->data)
            return false;
        
        bool l=inorder(r1->left,r2->left);
        
        bool r=inorder(r1->right,r2->right);
        
        return l && r;
    }
    
    //Function to check if two trees are identical.
    bool isIdentical(Node *r1, Node *r2)
    {
        //Your Code here
        
        return inorder(r1,r2);
        
    }