Structurally identical binary tree

in structurally identical explain the input part can’t visulaise binary tree and give some hint for its logic as well

Hello @shrutikatyal you have problem in building the tree?

yes , moreover how to show them structurally identical

That kind of input means whether there will be the child node on the left and right or not.
if there is inout like 10 true false this means that there will be left child node but no right child node.
Here for the reference i am attaching the code:
node* buildtree(string s){
if(s==“true”){
int d;
cin>>d;
string l;
cin>>l;
node*root=new node(d);
if(l==“true”){
root->left=buildtree(l);
}
string r;
cin>>r;
if(r==“true”){
root->right=buildtree®;
}
return root;
}
return NULL;
}

While traversing the tree you can check if roots of the both the trees are null then we will return true(AND condition).
if anyone of them is pointing to NULL that means not identical return false(OR condition).
Here for your reference i am attaching the code:
bool is_sametree(Treenodep,Treenodeq){
if(p==NULL and q==NULL){
return true;
}
if(p==NULL or q==NULL){
return false;
}

bool lefttree=is_sametree(p->left,q->left);
bool righttree=is_sametree(p->right,q->right);
return lefttree and righttree;

}

if you have any doubt you can ask here:
if you feel that your doubt is cleared you can mark the doubt as resolved.
Happy Learning !!