Delete node from BST


all test cases failed
where is it wrong ??

your way of creating bst is not correct
i have done modification in your code

check them

if you have any doubt feel free to ask

in line no 64 in your code
root->right = delete_node(root->right, replace->data);

why do we need to assign delete_node function into root->right, as it is already assigned so why do we need to do it here again ??

can u gve me any case where this LHS root->right is needed ???

if we have only 3 nodes

  40
60 70

in this case root->right is important

yess… but root ke right m pehle se (tree build ke samah se hi) right wale node ka address hoga
m reassign krne ki kya zarurat h ???

wo delete ho sakta hai
us case me wo return NULL karega
so we have to store that in root->right

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.