11596 - BSTR   

Description

Giving you a Binary Search Tree (BST) and a range, you need to remove all the nodes on the BST whose value is between the given range .

Input

The first line contains an integer N, represents the number of nodes in the BST.

The second line contains N integers, the first one is the value of root. For the remaining values, just insert them by BST's property.

The third lines contains 2 numbers, you need to remove all the nodes in the BST whose value is between these two numbers.

e.g. The BST constructed from sample input would be like : 

Output

Output the in-order traversal of the BST.

Note: The corret result should be in ascending order .

Sample Input  Download

Sample Output  Download

Partial Judge Code

11596.c

Partial Judge Header

11596.h

Tags




Discuss