Code giving runtime error
I have edited your code, it is producing output now, but the output is different from wht is expected, so for that plz change your print function, include these conditions in your code,
if(root->left!=NULL && root->right==NULL)
{
cout<left->data<<" => β<data<<β <= β<<βENDβ<<endl;
}
if(root->left ==NULL && root->right==NULL)
{
cout<<βENDβ<<β => β<data<<β <= β<<βENDβ<<endl;
}
if(root->left==NULL && root->right!=NULL)
{
cout<<βENDβ<<β => β<<β β<data<<β <= β<right->data<<endl;
}
if(root->left!=NULL && root->right!=NULL)
{
cout<left->data<<β => β<<β β<data<<β <= "<right->data<<endl;
}
I have edited your code, kindly refer to it.