I do not understand what sample test say
can you elaborate sample case with binary tree formation
with diagram
Structurally identical binary tree
structurally identical means that there structure is same that is along with the number of elements to be same , the placement of elements (nodes) should also be the same i.e. if an there are two elements on the left of root in tree 1 than two elements must be on the left of root in tree 2 if they are structurally same .
in the sample case we have been given two identical trees and identical trees are structurally identical also
these two are structurally identical
i known this you explained but i want to make the tree using this simple case 10 true 20 true 40 false false true 50 false false true 30 true 60 false false true 73 false false
@khemchandrs,
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;
}
you are not understand what can i say i want , can you dry run time test case 10 true 20 true 40 false false true 50 false false true 30 true 60 false false true 73 false false with manuall tree formation
for the input
10 true 20 true 40 false false true 50 false false true 30 true 60 false false true 73 false false
tree will be :
10
/ \
20 30
/ \ / \
40 50 60 73
In case of any doubt feel free to ask me 
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.
