getting run time eeror in test cases
but given test case in problem runs correctly
Delete node from bst
The logic you are using in your delete function is wrong, basically you need to include following conditions in your code as,
1st condition :
if(root==NULL)
{
return NULL;
}
2nd condition :
if(root->data==data)
{
if(root->left==NULL && root->right==NULL) // 0 child
else
if(root->left !=NULL && root->right==NULL) // 1 left child
{
}
else
if(root->left ==NULL && root->right!=NULL) // 1 right child
{
}
// 2 children case..
Pls include these conditions, and there is no need to use “search” function in your code, as this code will automatically search, based on recursion…