Assignment - 1.3: Questions
Assignment - 1.3: Questions
Assignment - 1.3: Questions
Assignment – 1.3
QUESTIONS
This assignment contains 10 questions covering Trees, BST, Heap and AVL
1. Which of the following is true for computation time in insertion, deletion and
finding maximum and minimum element in a sorted array?
2. The time complexity to build a heap of ‘n’ elements and Heap sort is____ and
_______.
3. Consider a array representation of ‘n’ element binary heap where the element are
stored from index 1 to index n of the array. For the element stored at index i of the
array (i<=n), the index of parent is______________
a. 2 b. 4 c. 3 d. 5
5. The following numbers are inserted into an empty binary search tree in the given
order: 10, 1, 3, 5, 15, 12, 16. At which level would 5 be inserted? Assume that root has
level 1.
A) 2
B) 3
C) 1
D) None of the above
6. Given the following numbers, arrange them into a Binary Search Tree. Let the root be
at position 1. If a node is at position is i, the left child will be at position 2i and right
child at 2i+1 ( i.e. the right child of root will be at position 3).
While forming a binary search tree by inserting 9, 5,1,12,6,7,8 in order, which positions
will be filled?
A). 1,2,3,4,5,11,23
B). 1,2,3,6,5,10,20
C). 1,2,4,8,3,6,12
D). 1,2,3,4,5,6,12
7. which of the following can be the sequence of nodes examined in BST while searching
for key 88?
A). 90,40,65,50,88
B). 90,110,80,85,88
C). 190,60,90,85,88
D). 65,140,80,70,88
8. The following there are known to be preorder, inorder and post order sequences of a
binary tree. But it is not known which is which.
I. M B C A F H P Y K
II. K A M C B Y P F H
III. M A B C K Y F P H
9. We are given with set of ‘n’ distinct elements and a unlabelled binary tree with ‘n’
nodes. In how many ways we can populate the a tree with a given set , so that it
becomes a BST?
A) 0 B)1 C) n! D)2nCn/n+1
10. I. The time taken to find the maximum element in a max heap is O(n)
II. The worst case time complexity of search an element in BST is O(logn)
IV. The time taken to find the minimum element in min heap is O(1)
A) I and II only