What is the problem with the please correct my approach,and my code
Satyam, in this question, you are given the array as input, so you need to use the native approach only for building the tree, i.e
if(root==NULL)
{
return new node(data);
}
if(data<=root->data)
{
root->left=insertInBST(root->left,data);
}
else
{
root->right=insertInBST(root->right,data);
}
The tree formed here using array will be different as compared to when it will be formed using the above approach.