Please give me the diagram of the binary tree, according to the testcase.
10 true 20 true 40 false false true 50 false false true 30 true 60 false false true 73 false false
STRUCTURALLY IDENTICAL - BINARY TREE - Doubt
Also, can u tell me how to construct the tree using false and true as inputs. I want to know how to proceed?
hey @Bumblebee, this the logic for building the tree
node * buidtree(string s){
if(s== " true "){
int d;
cin>>d;
node*root=new node(d);
string l;
cin>>l;
if(l==“true”){
root->left=buildtree(l);
}
string r;
cin>>r;
if(r==“true”){
root->right=buildtree ( r );
}
return root;
}
return NULL;
}
pass true in this function while calling from main function.
hey @Bumblebee , if your query is resolved. Please mark this doubt as resolved and rate me on the basis of your experience.
rating option will appear when to mark this doubt as resolved
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.