My delete function does not work

at line no 95

 else if(data<=root->val)
   {
       root->left=delete_in_bst(root->left,data);
       return root;
   }

equal to should not come only less than
because equal case has to handle sperately
so correct statement will be

 else if(data<root->val)
   {
       root->left=delete_in_bst(root->left,data);
       return root;
   }

Modified Code

1 Like