[Algo.Java] Got runtime error in 4 test case for the delete nodes in a bst problem

Here’s my code - https://ide.codingblocks.com/s/229592

@lousybrick,

https://ide.codingblocks.com/s/229603 corrected code.

I have added comments on the lines I have added.

a lot of cases were missing in the remove function when n1.left!=null &&n1.right==null and n1.left == null && n1.right != null. Also add a condition to return if node is null.

1 Like

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.

this code is passing only one test case