Question 1
The worst case running time to search for an element in a balanced in a binary search tree with n2^n elements is
(A) [Tex]\\Theta(n log n)[/Tex]
(B) [Tex]\\Theta (n2^n) [/Tex]
(C) [Tex]\\Theta (n) [/Tex]
(D) [Tex]\\Theta (log n) [/Tex]
A
B
C
D
Question 2
Let w(n) and A(n) denote respectively, the worst case and average case running time of an algorithm executed on an input of size n. which of the following is ALWAYS TRUE?
(A)
[Tex]A(n) = \\Omega(W(n))[/Tex]
(B)
[Tex]A(n) = \\Theta(W(n))[/Tex]
(C)
[Tex]A(n) = O(W(n))[/Tex]
(D)
[Tex]A(n) = o(W(n))[/Tex]
A
B
C
D
Question 3
A list of n strings, each of length n, is sorted into lexicographic order using the merge-sort algorithm. The worst case running time of this computation is
O(n log n)
O(n2 log n)
O(n2 + log n)
O(n2)
Question 4
An unordered list contains n distinct elements. The number of comparisons to find an element in this list that is neither maximum nor minimum is
Θ(nlogn)
Θ(n)
Θ(logn)
Θ(1)
Question 5
Which one of the following statements is TRUE for all positive functions f (n)?
[Tex]f(n^{2}) = \theta (f(n^{2})) [/Tex], when f (n) is a polynomial
[Tex]f(n^{2}) = o (f(n^{2}))[/Tex]
[Tex]f(n^{2}) = O(f(n^{2})) [/Tex], when f (n) is an exponential function
[Tex]f(n^{2}) = Ω(f(n^{2}))[/Tex]
Question 6
Which one of the following is the recurrence equation for the worst case time complexity of the Quicksort algorithm for sorting n(≥ 2) numbers? In the recurrence equations given in the options below, c is a constant.
T(n) = 2T (n/2) + cn
T(n) = T(n – 1) + T(0) + cn
T(n) = 2T (n – 2) + cn
T(n) = T(n/2) + cn
Question 7
Θ (n2)
Θ (n*log(n))
Θ (n1.5)
Θ (n)
Question 8
Consider the Quicksort algorithm. Suppose there is a procedure for finding a pivot element which splits the list into two sub-lists each of which contains at least one-fifth of the elements. Let T(n) be the number of comparisons required to sort n elements. Then
T(n) <= 2T(n/5) + n
T(n) <= T(n/5) + T(4n/5) + n
T(n) <= 2T(4n/5) + n
T(n) <= 2T(n/2) + n
Question 9
In quick sort, for sorting n elements, the (n/4)th smallest element is selected as a pivot using an O(n) time algorithm. What is the worst-case time complexity of the quick sort?
(A) θ(n)
(B) θ(nlogn)
(C) θ(n2)
(D) θ(n2 log n)
A
B
C
D
Question 10
In a balanced binary search tree with n elements, what is the worst-case time complexity of reporting all elements in the range [a,b]? Assume that the number of reported elements is k.
Θ(log n)
Θ(log(n)+k)
Θ(k log n)
Θ(n log k)
There are 76 questions to complete.