How to print the o/p

how to understand that there exists a left node or a right node as by the input example, it’s not clear.

Sample Input

3
1 2 3
3
3 2 1

Sample Output

2 => 1 <= END
3 => 2 <= END
END => 3 <= END

which thing is not clear in this??

the first array is preorder so it’s root left right seq but the o/p tree shows both 2 & 3 attached to the left side of root. My question is that how do we understand that there is no right node?

i think your doubt is about the sample output

Sample Output

2 => 1 <= END
3 => 2 <= END
END => 3 <= END

1 is root node it’s left is 2 and right is NULL
now we come to its left (preorder Traversal)
for 2 left is 3 and right is NULL
and for 3 both left and right is NULL
so tree look like

     1
    /
  2
 /
3

if your doubt is something else
please explain the doubt litile bit more

please check my code and remove the errors.

please share link of your code

how to send Link of Code ?
paste you code at

click on file->save->link will be generated
send the link of code generated
it will look like https://ide.codingblocks.com/s/258793