Code: Construct BST from a Sorted Array
The first line of input contains an integer, which denotes the value of n. The following line contains n space separated integers, that denote the values of array.
The first and only line of output contains values of BST nodes, printed in pre order traversal.
Time Limit: 1 second
7
1 2 3 4 5 6 7
4 2 1 3 6 5 7
Comments
Post a Comment