





Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!






~ CS170 First Midterm 23 Sep 1999
Key (see below):
Be clear and concise. You may use the number of points assigned to each problem as a rough estimate for the number of minutes you want to allocate to the problem. The total number of points is 80. This exam is closed book/closed computer, but you are allowed one sheet of paper (2 sides) for notes to use during the exam. You are allowed to use, without proof, any results proven in class, lecture notes, homework, or the book, but you must state clearly what result you are using. We are no longer allowed to post grades using SIDs, because of privacy rulings. So we ask you to pick a key that we will use to post your grades on-line. Pick something you can remember, that does not identify you personally, and that is very likely to be unique. Try adding the last 3 digits of your SID to guarantee uniqueness.
Give an algorithm which computes the maximum benefit path from a given vertex s to another vertex f. For example, if there are two paths from s to f , where Path 1 has edge weights -1, -2, -3 and Path 2 has edges weights -4, 10, 20, then Path 1 has benefit -3 and Path 2 has benefit -4, so Path 1 has the maximum benefit: -3 = max(-3,-4). Your algorithm should be as efficient as possible.
A. Brief description or pseudocode
B. Justification of correctness.
C. Running time and justification. You may refer to analyses done in class without proof.
True or false? No explanation required. except for partial credit. Each correct answer is worth 1.5 points, but 1.5 points will be subtracted for each wrong answer, so answer only if you are reasonably certain.
(a) n 2+sin^ n = O( n^2 )
(b) Dijkstras algorithm can fail if there are zero edge weights along with positive ones.
(c) Let G be an undirected, weighted graph. Running an MST algorithm on each biconnected component of G, and then adding the bridge edges to the set of MSTs of each biconnected component, results in a combined MST for the whole graph.
(d) Let G = (N,E) be an undirected graph. Let N = N 1 ∪N 2 be a partition of N into nonempty disjoint subsets, and G i the graph consisting of N i and all edges from E with both endpoints in N i. Let T i be an MST of G i. Then one can construct an MST T of G by connecting T 1 and T 2 by the shortest edge connecting N 1 and N 2.
(e) , if r > 0 and s > 0.