Perimeter of a binary search tree

0

0 votes
Problem

Print the perimeter of a given binary search tree in clockwise direction.

enter image description here

For e.g. in the above case the output should be: 8 10 14 13 7 4 1 3

INPUT First line of the input contains N ( no of nodes in the tree). Second line contains N space separated integers representing the nodes in the binary search tree.

OUTPUT Print the perimeter of a given binary search tree in clockwise direction. Separate each number by a space. See sample input output for more clarity

Time Limit: 2
Memory Limit: 256
Source Limit:
Editor Image

?