Help needed in debugging. Structurally Identical Binary Tree

My code is failing test case 0. Could you please tell where I am going wrong.

You are missing some base cases in your function isstructure.

Your function should be something like this:

bool isstructure(node* root1,node* root2){
if(root1 == NULL && root2 ==NULL){
return true;
}
if(root1==NULL && root2 != NULL){
return false;
}
if(root1 != NULL && root2 == NULL){
return false;
}

//In other cases
return (isstructure(root1->left,root2->left) && isstructure(root1->right,root2->right));

}

Also there was some compilation error with your code. Please correct that.

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.