Question 1
Which of the following is TRUE?
The cost of searching an AVL tree is θ (log n) but that of a binary search tree is O(n)
The cost of searching an AVL tree is θ (log n) but that of a complete binary tree is θ (n log n)
The cost of searching a binary search tree is O (log n ) but that of an AVL tree is θ(n)
The cost of searching an AVL tree is θ (n log n) but that of a binary search tree is O(n)
Question 2
What is the worst case time complexity of inserting n2 elements into an AVL-tree with n elements initially ?
Θ(n4)
Θ(n2)
Θ(n2 log n)
Θ(n3)
Question 3
A program takes as input a balanced binary search tree with n leaf nodes and computes the value of a function g(x) for each node x. If the cost of computing g(x) is min{no. of leaf-nodes in left-subtree of x, no. of leaf-nodes in right-subtree of x} then the worst-case time complexity of the program is
Θ(n)
Θ(nLogn)
Θ(n2)
Θ(n2log n)
Question 4
What is the worst case possible height of AVL tree?
2Logn (Assume base of log is 2)
1.44log n (Assume base of log is 2)
Depends upon implementation
Theta(n)
Question 5
T1, T2 and T3 are subtrees of the tree rooted with y (on left side) or x (on right side) y x / \\ Right Rotation / \\ x T3 – - – - – - – > T1 y / \\ < - - - - - - - / \\ T1 T2 Left Rotation T2 T3Which of the following is tightest upper bound for left-rotate and right-rotate operations.
Question 6
A 100 / \\ 50 200 / \\ 10 300 B 100 / \\ 50 200 / / \\ 10 150 300 / 5 C 100 / \\ 50 200 / \\ / \\ 10 60 150 300 / \\ \\ 5 180 400
Question 7
The recurrence relation that arises in relation with the complexity of binary search is:
T(n) = 2T(n/ 2) + k , where k is constant
T(n) = T(n / 2) + k , where k is constant
T(n) = T(n / 2) + log n
T(n) = T(n / 2) + n
Question 8
Suppose the numbers 7, 5, 1, 8, 3, 6, 0, 9, 4, 2 are inserted in that order into an initially empty binary search tree. The binary search tree uses the reversal ordering on natural numbers i.e. 9 is assumed to be smallest and 0 is assumed to be largest. The in-order traversal of the resultant binary search tree is
9, 8, 6, 4, 2, 3, 0, 1, 5, 7
0, 1, 2, 3, 4, 5, 6, 7, 8, 9
0, 2, 4, 3, 1, 6, 5, 9, 8, 7
9, 8, 7, 6, 5, 4, 3, 2, 1, 0
Question 9
A data structure is required for storing a set of integers such that each of the following operations can be done in O(log n) time, where n is the number of elements in the set. I. Deletion of the smallest element II. Insertion of an element if it is not already present in the set Which of the following data structures can be used for this purpose?
A heap can be used but not a balanced binary search tree
A balanced binary search tree can be used but not a heap
Both balanced binary search tree and heap can be used
Neither balanced search tree nor heap can be used
Question 10
O(m2 + n2)
There are 20 questions to complete.