-->
当前位置:首页 > 题库

PROGRAMMING:Complete binary search tree

Luz5年前 (2021-05-10)题库474
A sequence of non negative integers without repetition must correspond to a unique binary search tree whose shape is a complete binary tree. This problem requires you to output the tree sequence traversal sequence.
###Input format:
First, the first line gives a positive integer $$n $$($$Le 1000 $$), and then the second line gives $$n $$non negative integers that do not repeat. The numbers are separated by spaces, and all numbers are no more than 2000.
###Output format:
Output the sequence traversal sequence of the tree in one row. The numbers should be separated by one space, and there should be no extra space at the beginning and end of the line.
###Input example:
```in
ten
1 2 3 4 5 6 7 8 9 0
```
###Output example:
```out
6 3 8 1 5 7 9 0 2 4
```







answer:If there is no answer, please comment