Top MCQs on Balanced Binary Search Trees with Answers (original) (raw)

Which of the following is TRUE?

What is the worst case time complexity of inserting n2 elements into an AVL-tree with n elements initially ?

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

What is the worst case possible height of AVL tree?

Consider the following left-rotate and right-rotate functions commonly used in self-adjusting BSTs

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 T3

Which of the following is tightest upper bound for left-rotate and right-rotate operations.

Which of the following is AVL Tree?

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

The recurrence relation that arises in relation with the complexity of binary search is:

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

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?

Given two Balanced binary search trees, B1 having n elements and B2 having m elements, what is the time complexity of the best known algorithm to merge these trees to form another balanced binary tree containing m+n elements ?

There are 20 questions to complete.

Take a part in the ongoing discussion