#C8936. Custom Binary Tree Inorder Traversal
Custom Binary Tree Inorder Traversal
Custom Binary Tree Inorder Traversal
Given a non-negative integer \(n\), you are required to construct a binary tree based on the following specific rules:
- The binary tree is constructed in such a way that its in-order traversal yields the sequence of integers from \(1\) to \(n\) in increasing order.
If \(n = 0\), the tree is empty and you should output nothing.
Your task is to read the integer \(n\) from standard input, simulate the tree construction based on these rules, and then print the in-order traversal as output. The output numbers should be printed as space-separated values on a single line.
inputFormat
The input consists of a single line containing a non-negative integer \(n\).
outputFormat
Output the in-order traversal of the constructed binary tree. The numbers must be printed separated by a single space on one line. If \(n = 0\), print nothing.
## sample0