Compilation error


the given code is showing compilation error

your build tree function is not according to given input

make a new build tree fucntion

https://ide.codingblocks.com/s/265646 this code is giving segmentation fault

this is correct build Tree function

node*buildtree()
{
	int d;cin>>d;
    node*n=new node(d);

    string s;
    cin>>s;
    if(s=="true") n->left=buildtree();
    else n->left=NULL;
    cin>>s;
    if(s=="true")n->right=buildtree();
    else n->right=NULL;

    return n;
}

Modified Code

i hope this help
if you have more doubts regarding this feel free to ask
if your doubt is resolved mark it as resolved from your doubt section inside your course