#include <bits/stdc++.h>
using namespace std;
class node
{
public:
int data;
node*left;
node*right;
node(int d)
{
data=d;
left=NULL;
right=NULL;
}
};
int i;
node* builttree()
{
int d;
cin>>d;
if(d==-1)
{
return NULL;
}
node*root=new node(d);
root->left=builttree();
root->right=builttree();
if(root->left!=NULL && i==0)
{
if(root->data < root->left->data)
{
cout<<root->data<<" "<<root->left->data<<" ";
i++;
}
}
if(root->right!=NULL && i==0)
{
if(root->data > root->right->data)
{
cout<<root->data<<" "<<root->left->data<<" ";
i++;
}
}
return root;
}
// void recoverTree(node* root) {
// if(root==NULL)
// {
// return;
// }
// recoverTree(root->left);
// recoverTree(root->right);
// return;
// }
int main() {
/* code here /
i=0;
noderoot=builttree();
// recoverTree(root);
return 0;
}
it only pass one test case can you plzz tell me what the mistake in this code