Output coming wrong

I think I have done it right . There is some mistake in preorder traversal I guess. Plz look at it.

@udipt 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.dont sort it

https://ide.codingblocks.com/s/331100 I have attached the code of the input method for your reference.

here is your corrected code:

For every test case create a new object of tree.