Professional Documents
Culture Documents
Binary Search Tree
Binary Search Tree
Fix the code for base case in the insert() recursive function
Input Format:
First line contains N value where N denotes no of elements
Second line contains the space separated integers
Output Format:
Print the element in ascending order
Constraints:
NA
Sample Input 1:
6
60 40 50 10 30 20
Sample Output 1:
10 20 30 40 50 60
2) Binary Tree
Fix the code for creation of structure
Input Format:
3 interger Values
Output Format:
Display a root value, left value, right value
Constraints:
NA
Sample Input 1:
256
Sample Output 1:
The elements of tree root=2,left=5,right=6
Input Format:
First line contains N value where N denotes no of elements
Second line contains the space separated integers
Output Format:
Print the element in ascending order
Constraints:
NA
Sample Input 1:
5
50 30 80 20 90
Sample Output 1:
20 30 50 80 90
Input Format:
First line contains N value where N denotes no of elements
Second line contains the space separated integers
Third line contains the search element
Output Format:
Element is found at index %d
Constraints:
NA
Sample Input 1:
5
10 20 30 40 50
60
Sample Output 1:
Not found
Sample Input 2:
5
10 20 30 40 50
20
Sample Output 2:
Element is found at index 1
5)PREORDER
6) POST ORDER
ASCENDING
DES