Final Exam Part II
The due date for this quiz is Mon 20 May 2013 8:59 AM PDT -0700.
To specify an array or sequence of values in an answer, you must separate the values by a single space character (with no punctuation and with no leading or trailing whitespace). For example, if the question asks for the first ten powers of two (starting at 1), the only accepted answer is: 1 2 4 8 16 32 64 128 256 512 If you wish to discuss a particular question and answer in the forums, please post the entire question and answer, including the seed (which is used by the course staff to uniquely identify the question) and the explanation (which contains the correct answer).
In accordance with the Coursera Honor Code, I (Yinhuan Yuan) certify that the answers here are my own work.
Question 1
(seed = 388464) Which of the following statements about connectivity in an undirected graph are true? Check all that apply.
If there are two edge-disjoint paths connecting vertices u and v, then there is a simple cycle containing both u and v.
If you delete two edges from a graph G, its number of strong components can increase by at most 2.
A graph G that has a unique simple path between every pair of vertices has exactly V-1 edges.
Given a graph G and a vertex s, G is connected if and only if every vertex is connected to s.
Removing any edge from a connected graph G breaks the graph into two connected components.
Question 2
(seed = 599575) Which of the following statements about depth-first search are guaranteed to be true? Check all that apply.
If a vertex has no edges pointing from it, it will be first in any postorder
The postorder of a digraph G is the reverse of its preorder.
If there is a unique vertex reachable from every other vertex in a digraph, it will be first in some postorder.
The reverse postorder of a digraph's reverse is the same as the postorder of the digraph.
If a digraph has a vertex with no edges pointing from it, then some vertex with no edges pointing from it will be first in any postorder.
Question 3
(seed = 694838) Which of the following statements about minimum spanning trees (MSTs) are guaranteed to be true? Check all that apply.
Let G be a connected edge-weighted graph and let T be a MST of G. Then, the cheapest spanning tree of G besides T can be obtained by deleting the most expensive edge in T and computing the MST of the resulting graph.
Let G be a connected edge-weighted graph and let T be an MST of G. If you decrease the weight of some edge in T, then T will still be a MST.
Let G be a connected edge-weighted graph with distinct edge weights and no parallel edges. Then, the MST must contain the third cheapest edge.
Let T and T' be two MSTs of some edge-weighted graph and let a[] and b[] be the sorted array of edge weights. Then a[i] = b[i] for each i.
Let G be a connected edge-weighted graph with distinct edge weights and let (A, B) be a cut with at least 3 crossing edges. Then, the MST can contain the smallest and third smallest crossing edges without containing the second smallest crossing edge.
Question 4
(seed = 959653) Which of the following statements about shortest paths are true? Check all that apply.
If you run the Bellman-Ford algorithm on an edge-weighted digraph with positive edge weights and the shortest path from s to t has k edges, then Bellman-Ford will require at least k passes.
Bellman-Ford finds the shortest simple path from s to every other vertex, even if the edge weights are arbritary positive or negative integers.
Bellman-Ford finds the shortest simple path from s to every other vertex, even if the edge weights are positive or negative integers, provided there are no negative cycles.
Let G be a digraph with positive edge weights. During Bellman-Ford, if you trace back the edgeTo[] entries starting from v back to s, the path has distance equal to distTo[v].
Let G be a digraph with positive edge weights. Suppose that you increase the length of an edge by x. Then, the length of the shortest path from s to t can increase by more than x.
Question 5
(seed = 392474) Which of the following statements about maxflow and mincut are guaranteeed to be true? Check all that apply.
If all edge capacities are increased by an additive constant, then any mincut in the original network is a mincut in the modified network.
There exists a maxflow for which there is no directed cycle on which every edge carries positive flow.
Given a mincut (S, T) if the capacity of one edge is decreased by x, the value of the maxflow will decrease by exactly x.
If all edge capacities are integral, then any maxflow has integer flow on each edge.
If the capacity of some cut (S, T) equals the value of some flow f, then f is a maxflow.
Question 6
(seed = 725630) The column on the left contains the original input of 24 strings to be sorted; the column on the right contains the strings in sorted order; the other 7 columns contain the contents at some intermediate step during one of the 3 radix sorting algorithms listed below. moth lamb boar puma ibex toad bass boar bass puma hare bass tuna boar clam boar dove boar ibex carp carp lamb dove boar carp bass carp boar bass clam toad kiwi gnat clam carp clam dove ibex dove dove carp wren dove erne dove kiwi mink erne sole erne ibex erne clam erne carp lion gnat hare lion sole gnat hare gnat tuna kiwi hare mole lamb mole hare gnat hare sole clam ibex erne gnat mule ibex ibex ibex lion slug kiwi mule loon puma kiwi loon kiwi lamb gnat lion slug hare lamb lion lamb lamb wren toad lamb moth clam tuna lamb lion lion gnat boar loon kiwi bass erne loon kiwi loon loon sole moth mink moth mink moth moth mink hare mole mole clam mink lion mole mink mole clam loon mink lion mole loon mink mole moth bass moth mule wren mule hare mule mule mule oryx dove oryx loon slug carp oryx slug oryx slug wren puma carp oryx bass puma oryx puma mole erne sole boar toad moth sole toad slug toad oryx slug bass wren slug slug wren sole erne mule tuna gnat sole dove tuna sole toad mink puma toad ibex tuna kiwi toad tuna tuna mule tuna wren oryx puma oryx wren puma wren ---- ---- ---- ---- ---- ---- ---- ---- ---- 0 ? ? ? ? ? ? ? 4 Match up each column with the corresponding sorting algorithm from the given list: 0. Original input 1. LSD radix sort 2. MSD radix sort 3. 3-way radix quicksort (no shuffle) 4. Sorted You may use an algorithm more than once. Your answer should be a sequence of 9 integers between 0 and 4 (starting with 0 and ending with 4) and with each integer separated by a single space. Hint: think about algorithm invariants. Do not trace code.
Answer for Question 6
Question 7
(seed = 727971) What is the Burrows-Wheeler inverse transform of the following? 5 B D A C D D A A Your answer should be a sequence of 8 characters, with a single space separating each character.
Answer for Question 7
Question 8
(seed = 955798) Which problems are known to have the same asymptotic complexity as multiplying two N-bit integers? Check all that apply.
Computing the remainder when dividing one N-bit integer into an N-bit integer.
Adding two N-bit integers.
Computing the remainder when dividing an N-bit integer by 17.
Squaring an N-bit integer.
Factoring an N-bit integer.
Question 9
(seed = 908805) Consider the following linear programming simplex tableaux with 6 equations and 8 variables: maximize Z - 3 x1 + 3/4 x7 - Z = -156 --------------------------------------------------------------------------------------------------------- + 4 x1 + 1 x5 + 1 x7 = 18 + 1 x0 - 1 x1 - 6/5 x7 = 24 + 3/2 x1 + 1 x4 + 3/5 x7 = 42 + 5/4 x1 + 1 x2 + 1/2 x7 = 48 + 2 x1 + 1 x6 - 5/2 x7 = 30 + 5/2 x1 + 1 x3 = 48 x0 , x1 , x2 , x3 , x4 , x5 , x6 , x7 >= 0 What is the value of variable x5 in the current basic feasible solution? Specify your answer with two digits after the decimal place.
Answer for Question 9
Question 10
(seed = 940895) A problem is intractable if and only if it cannot be solved in
linear time
constant time
exponential space
exponential time
polynomial time
Question 11
(seed = 899132) You are applying for a job at a new software technology company. Your interviewer asks you to identify which of the following tasks are known to be possible. Check all that apply.
Given an undirected graph and two vertices s and t, find a path from s to t in E + V time.
Given an undirected graph, design an E + V algorithm to find a spanning tree.
Given an undirected graph, find an edge whose removal increases the number of connected components in (E+V) E time.
Given an digraph, design an E V algorithm to find the shortest directed cycle.
Given a digraph with positive edge weights and two vertices s and t, design an E + V algorithm to find a max st-flow.
Question 12
(seed = 121999) You are applying for a job at a new software technology company. Your interviewer asks you to identify which of the following tasks are known to be possible. Check all that apply.
Given an array of N strings, sort them in time linear in N in the worst case.
Determine whether a pattern string of length M is a substring of a text string of length N using a constant amount of extra memory.
Compute the suffix array of a string of length N in time proportional to N log N in the worst case.
Determine whether an M-character regular expression matches an N-character text in time polynomial in M and N.
Construct a DFA corresponding to an M-character regular expression.