Its not printing the orrect order
hello @guptanikhil898
u have misunderstood the problem. u need to form balanced bst but u r forming normal bst thats why u r getting different order.

@guptanikhil898
floow this->
- Get the Middle of the array and make it root.
- Recursively do same for left half and right half.
- a) Get the middle of left half and make it left child of the root created in step 1.
- b) Get the middle of right half and make it right child of the root created in step 1.

what is difference beween bst and balanced bst
balaced tree will have height log(n) in worst case whereas in normal bst it can go upto o(n)
whats wrong in this code i is checking if tree is balanced or not please tell.
test case 2 i having problem
@guptanikhil898
i think u have misunderstood the problem.
u dont have to check the tree is balanced or not.
instead u have to construct balanced bst from given array . and algorithm for the same i shared before.
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.