question:https://hack.codingblocks.com/contests/c/608/1280
not getting the correct output
it should be 4 3 2 5 6
i m getting 4 2 3 5 6 in preorder traversal
i m getting the range correct
Https://ide.codingblocks.com/s/60614
Hi Aastha, this is happening because you’re sorting the given array and then creating the bst. You don’t have to change the order of the given array. I’ve modified your createbst function and you can refer to the correct code here: https://ide.codingblocks.com/s/60897
1 Like