What am i missing in this case

Here is the link of my code.

Hello @great you are not forming the tree in the correct way.

Thanks a lot Tushar for your reply. Actually, I am understanding this method but my doubt is, from the code which I have written, it is also generating a BST only.
Please see to it once and let me know …( also this is the way in one of challenges had been solved on build_balanced_bst)

Hello @great in this you have to form the tree in the different manner considering the first element as the root of the tree and after that you have to check if the root value is less than it will go to left and otherwise to the right.
there are few more printinh mistake according to the output format.
like before printing the preorder traversal you have to first print this
cout<<"# Preorder : “; and also before printing the nodes of the range you have to do this: cout<<”# Nodes within range are : ";

One more thing your code is even giving the wrong order when doing the preorder traversal.
this is the correct code: https://ide.codingblocks.com/s/427504

Sure, got it.
Thanks

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.