Run time error!

what conditions i am missing. please debug it.
link to my code - https://ide.codingblocks.com/s/247776

hey, i am unable to get what logic u are trying to apply to this, although some mistakes i found are:
let me just point out the mistakes

  1. question demands the answers in sorted order, so store the values in a global vector and sort it in the end and display
  2. if the vector is empty then u can print -1 that is no nodes present
  3. u don’t need to find the node, u can apply the same checks on the node’s value
  4. in ur left and right’s recursive calls u r sending i++. which sends the same value and increments for this function(the calling function), so i is never incremented in real sense and hence an infinite loop
    https://ide.codingblocks.com/s/242560 reference code

not able to pass test case 1 and 2. please debug it . https://ide.codingblocks.com/s/247776

hey, the error in ur code, is mentioned in my first line itself , the output has to be sorted