You are on page 1of 3

1.

If h is any hashing function and is used to hash n keys in to a table of size m, where
n<=m, the expected number of collisions involving a particular key x is
a. less than 1
b. less than n
c. less than m
d. less than n/2

2. An algorithm is made up of two independent time complexities f (n) and g (n). Then
the complexities of the algorithm is in the order of
a. f(n) x g(n)
b. Max ( f(n),g(n))
c. Min (f(n),g(n))
d. f(n) - g(n)

3. Let A be a finite nonempty set with cardinality n. The number of subsets S ⊏ A


having odd cardinality is
a. n
b. 2n/2
c. 2n-1
d. Not determinable

4. A certain algorithm A has been shown to have a running time O(N2.5) the size of the
input. Which of the following is NOT true about algorithm A?
a. There exists two non-negative constants C1 and C2 such that for all N the
running time is less than C1N2.5+C2 seconds
b. For all N, there may be some inputs for which running time is less than N2.4
seconds
c. For all N, there may be some inputs for which running time is less than N2.5
seconds
d. For all N, there may be some inputs for which running time is more than N2.5
seconds

5. You have to sort a list L consisting of a sorted list followed by a few “random”
elements. Which of the following sorting methods would be especially suitable for
such a task?
(a) Bubble sort (b) Selection sort (c) Quick sort (d) Insertion sort

6. The worst case running time to search for an element in a balanced binary search tree
with n2n elements is
(a) O(nlogn) (b) O(n2n) (c) O(n) (d) O(logn)

7. A sorting algorithm is said to be stable


a. If it uses only one array
b. If it uses more than one array
c. If duplicate elements are not allowed
d. If duplicate elements remain in the same relative position after sorting

8. What is the solution to the recurrence T(n) = T(n/2)+n, T(1) = 1


(a) O(logn) (b) O(n) (c) O(nlogn) (d) O(2n)
9. If a connected graph has v vertices and e edges, then to obtain a spanning tree we
have to delete
a. v-e+1 edges.
b. e -v +1 edges
c. e-v-1 edges.
d. None of the above

10. Which of the following relationship between number of back edges and number of
cycles in DFS is false?
a. No back edges means no cycles.
b. Number of back edges is equal to number of cycles
c. One back edge may result in one to exponential number of simple cycles
d. None of the above

11. Let w be the minimum weight among all edge weights in an undirected connected
graph. Let e be a specific edge of weight w. Which of the following is FALSE?
a. There is a minimum spanning tree containing e.
b. If e is not in a minimum spanning tree T, then in the cycle formed by adding e
to T, all edges have the same weight
c. Every minimum spanning tree has an edge of weight w .
d. e is present in every minimum spanning tree

12. Kruskal's algorithm is an example of


a. Divide and Conquer
b. Dynamic Programming
c. Greedy Algorithm
d. Backtracking

13. Which of the following use DFS?


a. Topological Sort
b. Finding Strongly Connected Components
c. Finding Cut Vertices
d. All of the above

14. The lower bound for worst case time complexity for any comparison sorting
algorithm is
a. Ω(log n)
b. Ω(n log n)
c. Ω(n2)
d. Ω(n)

15. T1(n) ∈Θ(g1(n)) ∧T2(n) ∈Θ(g2(n)) ⇒T1(n) + T2(n) ∈Θ(max{g1(n), g2(n)}) says that
a. the slower and faster parts of an algorithm together set its running time;
b. the faster part of an algorithm dominates in determining running time;
c. the slower part of an algorithm dominates in determining running time;
d. Algorithm T finds the maximum of g1and g2

16. In worst case, Quicksort is


(a) O(1); (b) O(lg n); (c) O(n lg n); (d) O(n2); (e) O(2n)
17. Dynamic Programming algorithms make use of
(a) a straightforward solution to a problem by examining all possible solutions;
(b) the fact that an optimal solution can be constructed by adding the cheapest next
component, one at a time;
(c) the fact that data is arranged so that at each step, half the remaining input data can
disposed of;
(d) effort can be saved by saving the results of previous effort in a table;
(e) none of these

18. The BST search uses which approach to algorithm design?


(a) divide and conquer; (b) greedy; (c) brute force; (d) dynamic programming;
(e) probabilistic

19. To implement a priority queue, it is most time-efficient to use a


(a) simple vector; (b) linked list; (c) heap; (d) binary search tree; (e) hash table

20. Consider the process of inserting an element into a Max Heap, where the Max Heap
is represented by an array. Suppose we perform a binary search on the path from the
new leaf to the root to find the position for the newly inserted element, the number of
comparisons performed is:
a. log n
b. log log n
c. n
d. n log n

You might also like