You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
if(p==NULL && q==NULL) // checking if both of the node of the tree is NULL
return true;
if(p!=NULL && q==NULL) // checking if anyone of the node of the tree is NULL
return false;
if(p==NULL && q!=NULL) // checking if anpne of the node of the tree is NULL
return false;
if(p->val!=q->val) // checkin if they are not null then they are having the same value or not
return false;
return isSameTree(p->right,q->right) && isSameTree(p->left,q->left); // trying the smae for the left and right nodes for both of the trees in a recursive way;