The test is open-everything with the sole limitation that you
neither solicit nor give help while the exam is in progress.
Do all five problems. There is a thirty minute time
limit on this exam, so work quickly. If you didn't study,
and need to run to the computer or the web to look stuff up,
you'll definitely be less likely to finish.
| Problem | You got | Out of |
1 | | 8 |
2 | | 20 |
3 | | 32 |
4 | | 20 |
5 | | 20 |
TOTAL | | 100 |
- Solve for x. No calculators.
Solve exactly, Show your work. (Note log2 stands for log base 2
and log5 stands for log base 5).
3^(log2(log5(x))) = (6 / log2(5))^log2(3)
- Give the complexity function T
for the following code fragment, both as (a) a recurrence relation
and (b) in closed form using Θ-notation.
public static long f(List a) {
if (a.size() > 1) {
f(a.subList(0, a.size()/2));
f(a.subList(3*a.size()/8, 7*a.size()/8));
f(a.subList(a.size()/4, 3*a.size()/4));
f(a.subList(a.size()/8, 5*a.size()/8));
f(a.subList(a.size()/2, a.size()));
for (int i = 0; i < a.size(); i++) {
for (int j = 0; j < i; j++) {
System.out.print("*");
}
}
}
}
- For the following graph:

- How many blocks are there?
- Give a Depth First Traversal.
- Give a Breadth First Traversal.
- Give a Minimum Spanning Tree.
- Can Dijkstra's algorithm be used to find a shortest path from F to B?
- Give the shortest path from F to B.
- Is this graph simple? Why or why not?
- Which edges are bridges?
- Which nodes are articulation points?
- Is there a Hamilton Cycle? If so, name one. If not, why not?
- Identify a trail (any trail).
- Is there an Euler tour? If so, name one. If not, why not?
- Give a smallest vertex cover.
- What is the degree of node D?
- How many isolated nodes are there?
- Is the graph complete?
- Extra Credit: What is the chromatic number of this graph?
- Extra Credit: What is the maximum flow of this graph?
- Show the progress of (a) an insertion sort
and (b) mergesort, applied to the array 45 21 3 99 14 17 88. That is,
show the array after each "pass".
- A binary min-heap starts off empty.
Show its shape (actually draw the tree) after each of the steps in the
following sequence. By min-heap we meam smaller values should appear on top.
- Insert 10
- Insert 4
- Insert 16
- Insert 3
- Insert 1
- Remove
- Insert 7
- Remove
- Remove
- Remove