Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 3

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

3) BINARY SEARCH TREE


Fix the code for insert() 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:
5
50 30 80 20 90

Sample Output 1:
20 30 50 80 90

4) BINARY SEARCH USING ARRAY


Fix the code search binary search function

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

You might also like