i am trying to find if the root of a tree becomes null and thr root of other three does not so the are not identical
Doubt in my approach
yes you can try this approach
the code you have share does not contain any function related to “structurally identical”
Reference Code
bool isStructurallyIdentical(node*root1,node*root2){
if(root1==NULL&&root2==NULL){
return true;
}
if(root2==NULL||root1==NULL){
return false;
}
bool lans=isStructurallyIdentical(root1->left,root2->left);
if(lans==false)return false;
bool rans=isStructurallyIdentical(root1->right,root2->right);
return rans;
}
I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.
On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.