Problem1361--为二叉排序树排序

1361: 为二叉排序树排序

Time Limit: 1 Sec  Memory Limit: 128 MB
Submit: 327  Solved: 223
[Submit] [Status] [Web Board] [Creator:]

Description

现在给你两棵二叉排序树,要求你对两棵二叉排序树的中的所有元素进行升序排序。

Input

输入两行,每一行按照先序输入一棵二叉排序树,其中空节点用 -1 表示(二叉树的结点不超过2000)。

Output

输出升序排序之后的结果。

Sample Input

2 1 -1 -1 4 -1 -1
1 0 -1 -1 3 -1 -1

Sample Output

0 1 1 2 3 4

Source/Category