Exam
Exam
Introduction
The Data Structures and Algorithms portion of the Masters Comprehensive Exam (MCE) represents
approximately 1/3 of the exam. The DS&A portion emphasizes basic knowledge and reasoning over
in-depth problem analysis, since it has over 30 questions, and the entire comprehensive exam lasts
for three hours.
Since the MCE lasts for three hours, this leaves about one hour to complete the DS&A portion,
which in turn leaves about two minutes to answer each problem. There is NO penalty for guessing,
so make sure to answer each one. It is therefore recommended to take this practice test in a hour
sitting, and without referring to the answers until the exam has been completed.
Exam grades are determined by the CECS Graduate Committee. Please see the CECS Graduate
Advisor for more information.
Questions
1. Which of the following expressions surely supports the statement f (n) = Ω(g(n))?
1
d) none of the above
2. Let k denote the degree of polynomial p(n), and l the degree of polynomial q(n). If p(n) =
o(q(n)), then necessarily
a) k = l.
b) k < l.
c) k > l.
d) none of the above
a) f (n) = o(g(n)).
b) f (n) = Θ(g(n)).
c) f (n) = ω(g(n)).
d) both a) and b) are always true.
4. Which of the following expressions best describes the growth of the sum 1+1/2+1/3+· · ·+1/n?
a) Θ(1/n)
b) Θ(1)
c) Θ(log n)
d) Θ(n log n)
5. Given positive functions f (n) and g(n), if we know that lim (log f (n) − log g(n)) = 1, then we
n→∞
also know that
a) f (n) = o(g(n)).
b) f (n) = Θ(g(n)).
c) f (n) = ω(g(n)).
d) more information is needed about f and g to reach a definite conclusion.
6. An algorithm takes as input an n × n Boolean matrix A. If the running time of the algorithm
is T (n) = O(n log n) when n is used as the input size parameter, then which of the following
expressions describes the big-O growth of T (m), the running time of the algorithm when m = n2
is used as the size parameter?
√
a) O( m log m)
b) O(m2 log m)
c) O(m log m)
d) O(m2 log2 m)
8. If a separate-chaining hash table has load factor λ = 5, then the average length of a chain
equals
a) 5.
b) log 5.
c) 5 log 5.
d) log(log 5).
9. Perfect hashing
10. The worst case running time T (n) for inserting n elements into an initially-empty heap is
a) T (n) = O(n2 ).
√
b) T (n) = O( n log n).
c) T (n) = O(n).
d) T (n) = O(n log n).
11. The worst case running time T (n) for popping an element from a binary heap of size n is
a) T (n) = O(1).
b) T (n) = O(log n).
c) T (n) = O(n).
d) T (n) = O(n log n).
12. Which of the following algorithms does not require a heap for its efficient implementation?
a) Huffman’s algorithm
b) Dijkstra’s algorithm
c) Kruskal’s algorithm
d) Prim’s algorithm
13. Which of the following graph problems cannot be solved in time that is linear with respect to
the sum of the number of vertices and edges in the graph (i.e. O(m + n)).
14. Suppose directed graph G is weakly but not strongly connected, and path P = a, b, c, d provides
a weak (but not strong) connection from a to d within G. Then we surely know that
15. Let G = (V, E) be the undirected graph whose edges are {(a, b), (b, c), (c, d), (a, d)}. If T is the
depth-first spanning tree of G rooted at vertex a, it follows that T has branch(es).
a) 1
b) 2
c) 3
d) 4
16. The worst case running time T (n) for inserting n elements into an initially-empty binary search
tree is
a) T (n) = O(n2 ).
√
b) T (n) = O( n log n).
c) T (n) = O(n).
d) T (n) = O(n log n).
17. Binary search tree T is said to be balanced when, for every node n in T ,
18. If numbers from the set {1, . . . , n} are selected at random (without replacement) and inserted
into an initially-empty binary search tree, then the big-O expression that best describes the
average (taken over all possible resulting trees) height of the resulting tree is
a) O(n).
b) O(log n).
√
c) O( n).
d) O(n).
19. Which of the following sorting tasks would not be appropriate for Counting Sort?
20. Which of the following best describes the worset-case running time of Insertion Sort when
sorting n 32-bit unsigned integers?
√
a) T (n) = Θ( n)
b) T (n) = Θ(n)
c) T (n) = Θ(n log n)
d) T (n) = Θ(n2 )
21. Quicksort is guaranteed to run in time O(n log n) so long as the pivot is
a) randomly selected.
b) set to the median of the first, middle, and last array element.
c) set to the median of the array.
d) none of the above
a) remove the edge of greatest cost from the graph so long as its removal does not disconnect
the graph.
b) add the edge of least cost to the forest so long as its addition does not create a cycle.
c) add the vertex having least connection cost to the current tree.
d) remove the vertex having greatest connection cost from the tree.
24. Which of the following greedy algorithms has an implementation that most resembles that of
Dijkstra’s algorithm?
a) Kruskal’s algorithm
b) Prim’s algorithm
c) Huffman’s algoirthm
d) Floyd-Warshall algorithm
√
25. If T (n) satisfies T (n) = 2T (n/3) + n, then
√
a) T (n) = Θ( n).
b) T (n) = Θ(n2 ).
c) T (n) = Θ(nlog3 2 ).
d) T (n) = Θ(nlog 3 ).
26. Which of the following recurrences cannot be solved directly by the Master Theorem?
a) T (n) = Θ(n2 ).
b) T (n) = Θ(n2.5 ).
c) T (n) = Θ(nlog 7 ).
d) T (n) = Θ(n3 ).
29. All of the following problems can be solved with a dynamic-programming algorithm that runs
in worst-case polynomial time, except for
a) the distance from i to j when restricted to paths that traverse at most k edges.
b) the distance from i to j when restricted to paths that traverse at least k edges.
c) the distance from i to j when restricted to paths whose intermediate vertices must lie
within the set {1, . . . , k}.
d) the distance from i to j when restricted to paths whose intermediate vertices must lie
within the set {k + 1, . . . , n}.
31. The problem of determining if a bipartite graph has a perfect matching is most naturally
reduced to the problem of
32. The problem of determining the maximum flow in a directed network is most naturally reduced
to the problem of
33. Professor Jones has just proved that there is no polynomial-time algorithm for solving the 0-1
Knapsack optimization problem. Because of this we also know there is no polynomial-time
algorithm for solving each of the following problems, except for
34. The Subset Sum decision problem is most closely associated with
2. b
3. b
4. c
5. b
6. a
7. b
8. a
9. d
10. d
11. b
12. c
13. c
14. c
15. a
16. a
17. c
18. b
19. a
20. d
21. c
22. b
23. a
24. b
25. c
26. d
27. c
28. b
29. d
30. c
31. c
32. c
33. d
34. a