Can U pls explain me how to take the input in this case???
How to take input
node *buildtree()
{
string d;
cin>>d;
if(d==“false”)
return NULL;
else if(d==“true”)
{
int a;
cin>>a;
node *root = new node(a);
root->left = buildtree();
root->right = buildtree();
return root;
}
else
{
stringstream geek(d);
int x = 0;
geek >> x;
node *root = new node(x);
root->left = buildtree();
root->right = buildtree();
return root;
}
}
Use this code for building the tree
Thnx…will rate u 5 star…