Write Code to Determine if Two Trees are Identical

PHOTO EMBED

Sun Jul 10 2022 12:02:21 GMT+0000 (Coordinated Universal Time)

Saved by @Ranjan_kumar #c++

class Solution
{
    public:
    //Function to check if two trees are identical.
    bool isIdentical(Node *r1, Node *r2)
    {
        if(r1==NULL && r2==NULL) return 1;
        if(r1!=NULL && r2!=NULL)
        { return
          (r1->data==r2->data 
          && isIdentical(r1->left,r2->left) 
          && isIdentical(r1->right,r2->right));
        }
        return 0;
        //Your Code here
    }
};
content_copyCOPY

https://practice.geeksforgeeks.org/problems/determine-if-two-trees-are-identical/1/#