Delete nodes from bst

i have tried so many times. but I am still not able to figure out the error of segmentation fault and all. please check it

Hi… what u are doing wrong is first storing all the tree elements , sorting then and the building tree… but what actually u have to do is build tree from the order which u get for the elements. refer this https://ide.codingblocks.com/s/605758
and then what u have to do is store all nodes to be deleted traverse over then and delete one by one the required node…

why arent we putting replace as NULL because that shouldnt be there because it got replace with root->data. ?

but that doesn’t mean na all nodes in that subtree are to be deleted also…

code is successful but printing is not what I want to print

please check my code rather than sending reference

give an endl statement after every test case… ur code will work

no its still not working please check

image
what u are making is not a bst… refer to video lectures of bst or my code on whats the way to build bst

i have done the correction. please check again.


there were many minor errors in ur code… i have corrected it… its working fine now…

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.