I can't build the tree from this type of input

plz provide me the code to buildt tree from this input

Akshay, here true means having a child and false means there is no child… So you can take a node value and a string value … and then based on these two values, you can build your tree as,

node *buildtree(node *&root)
{
if(x==0)
{
x++;
int k;
cin>>k;
root=new node(k);
root->left=buildtree(root->left);
root->right=buildtree(root->right);
return root;
}
else
{
string str;
cin>>str;
int d;
if(str==“true”)
{
cin>>d;
node *temp=new node(d);
temp->left=buildtree(temp->left);
temp->right=buildtree(temp->right);
return temp;
}
else
if(str==“false”)
{
return root;
}
}
return root;
}