Unable to pass test cases

please help me in finding the error.

1 Like

Please help me out my code is correct i think but it is unable to pass test cases

The array given in the input is not the preorder traversal of the BST to be formed. It is just a random unsorted array and you need to create a BST from the given unsorted array.

https://ide.codingblocks.com/s/331100 I have attached the code of the input method of your reference. The code in the video was for sorted arrays

Mam still Im getting wrong answer .plz check i have put the link above

hey @mujy1234
corrected code:

Errors:

  1. Add syso at the end of every tree.print.
  2. For every test case create a new object of tree.
  3. dont make root static

Thank You mam. Got it