I am getting run error for all test cases except one which is showing correct. The code is running fine on my laptop. Why is it giving run error?
Run error in deleting nodes from BST
hello @Aditya.Jethliya
build a normal bst ie build tree by inserting element one by one.
and then apply ur deletion logic
I have added inorder print function now. So you check that after building bst preorder and inorder traversal are as they should be and a preorder and inorder traversal uniquely defines a binary tree. So the tree is building correctly. There is some other problem
the issue is with ur buildtree function only (it is not mentioned in problem that we are given preorder or some other traversal) .
once try to build normal bst and then try.
It worked! Thanks for your help.
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.