My code is failing for a case
5 3 7 1 6 8 -1
3
BST deletion problem
Hello @sounakume,
-
There are number of test cases.
You are not taking input for that. -
You have to print the preorder traversal in the question
-
There is significance of using this condition:
// if (root == NULL)
// {
// return NULL;
// }
Rest of your code seems correct.
Hope, this would help.
Give a like if you are satisfied.
My code is not working for the case i mentioned above, even if i dont print preorder why does it matter, im not putting it in a judge yet,
i didnot understand your 3 point either , there are a lot of places where i have used that condition, which function are u reffering to??
please check my code for the case i have mentioned above, and tell me what exactly im doing wrong,
It a case of 1 children. Im getting segmentation fault for that.
For now , im printing it level wise not pre order and also not considering cases, error is not there.
Hello @sounakume,
Pardon me for replying late. I was kinda sick.
Point 3 is of findSucce() function.
To eliminate the problem you have mention,
remove these two lines:

It will delete left and right subtree along with the root node
Give a like if you are satisfied.
thank you, i got it now