Explain the criteria

explain the criteria of printing number in this range
i mean why only 3 4 5 not 4 5 3
https://hack.codingblocks.com/contests/c/608/1280

print them like you print in inorder traversal

so in sorted order ???

giving wrong answer
https://ide.codingblocks.com/s/56959

help here please…

Hey Gaurav, your logic is correct, you have made some small mistakes:

  • you are supposed to print output for each test in a new line so update main() line:92 as this

      printInRange(root,a,b);
      cout<<endl;
    
  • You are supposed to make a new tree for every test case so put node *root=NULL; statement inside while(t) loop.

1 Like

thank you so much…this code annoyed me so much…but solved it quickly