Binary Tree - Structure Identical

The question should provide number of nodes of the tree, how will I know from when the second tree’s inputs start?

@rohit267,
Here Input is taken in pre-order (root,left,right) fashion here the first value is our root_value and for every node true tells us the node exist and the next value is the node value and false means that the node is NULL
refer this code for more clearity

node*buildtree(){
    int d;
    cin>>d;
    string leftexist, check;
    cin>>leftexist;
    check = "true";
    node*root = new node(d);
    if(leftexist==check){
        root->left = buildtree();
    }
    else{
        root->left = NULL;
    }
    string rightexist;
    cin>>rightexist;
    if(rightexist==check){
        root->right = buildtree();
    }
    else{
        root->right = NULL;
    }
    return root;
}

So all you need to implement in the main function is
node* root1=buildTree();
node* root2=buildTree();
you don’t have to worry about when the second tree’s input start

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.

https://ide.codingblocks.com/s/237838, two testcase failed 2nd and last

Cross check your code with this case:
50 true 290 true 23 false false false true 78 true 66 false false false
10 true 20 true 40 false false true 50 false false true 30 true 60 false false true 73 false true 88 false false

Output must be false.

You are complicating your is identical function.
Your function should be something like this:

bool isidentical(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 (isidentical(root1->left,root2->left) && isidentical(root1->right,root2->right));

}