Getting wrong output

please tell me my mistakes and how to correct them

@shivamgoel150 you have to do the pre-order traversal of the whole tree,

  1. print root
  2. visit left subtree
  3. visit right subtree
    you are doing inorder traversal.

corrected code: https://ide.codingblocks.com/s/291494

https://ide.codingblocks.com/s/291494 still not passing the test case