Trees - print bst keys in given range

Its producing wrong output for preorder . Also In the question, its not mentioned that which element we have to take as root element. What is the issue in this?

@yashomar95,
The input is taken as a generic tree. It takes the data of the node and the number of children the node will have.
If no of children = 0 then that node will be a leaf node.
For eg. in the sample test case
data of root node = 1 , and it has two children.

I am talking about the question “Print bst keys in given range”.I am not getting how bst is to be formed using the given array because the array is not sorted. And if I myself sort it, then whch index element from array should I take as the root element.

@yashomar95 I have replied to you on chat. Kindly check