Coursera

Question 1

Consider a connected undirected graph with distinct edge costs. Which of the following are true? (Check all that apply.)

Question 2

You are given a connected undirected graph $G$ with distinct edge costs, in adjacency list representation. You are also given the edges of a minimum spanning tree $T$ of $G$. This question asks how quickly you can recompute the MST if we change the cost of a single edge. Which of the following are true? (RECALL: It is not known how to deterministically compute an MST from scratch in $\mathcal{O}(m)$ time, where $m$ is the number of edges of $G$.) (Check all that apply.)

Question 3

Which of the following graph algorithms can be speed up using the heap data structure?

Question 4

Which of the following problems reduce, in a straightforward way, to the minimum spanning tree problem? (Check all that apply)

Question 5

Recall the greedy clustering algorithm from lecture and the max-spacing objective function. Which of the following are true? (Check all that apply.)

Question 6

We are given as input a set of $n$ jobs, where job $j$ has a processing time $p_j$ and a deadline $d_j$​. Recall the definition of completion times $C_j$​ from the video lectures. Given a schedule (i.e., an ordering of the jobs), we define the lateness ��lj​ of job $j$ as the amount of time $C_j-d_j$ after its deadline that the job completes, or as 0 if $C_j\leq d_j$​.

Our goal is to minimize the total lateness,

$$ \sum_j l_j $$ Which of the following greedy rules produces an ordering that minimizes the total lateness? You can assume that all processing times and deadlines are distinct. WARNING: This is similar to but not identical to a problem from Problem Set #1 (the objective function is different).

Question 7

Consider an alphabet with five letters, ${a,b,c,d,e}$, and suppose we know the frequencies $f_a​=0.28, f_b​=0.27, f_c​=0.2, f_d​=0.15$, and $f_e​=0.1$. What is the expected number of bits used by Huffman’s coding scheme to encode a 1000-letter document?

Question 8

Which of the following extensions of the Knapsack problem can be solved in time polynomial in $n$, the number of items, and $m$, the largest number that appears in the input? (Check all that apply.)

Question 9

The following problems all take as input two strings $X$ and $Y$, of length $m$ and $n$, over some alphabet $\Sigma$. Which of them can be solved in $\mathcal{O}(mn)$ time? (Check all that apply.)

Question 10

Consider an instance of the optimal binary search tree problem with $7$ keys (say $1,2,3,4,5,6,7$ in sorted order) and frequencies $w_1​=0.2,w_2​=0.05,w_3​=0.17,w_4​=0.1,w_5​=0.2,w6​=0.03,w_7​=0.25$. What is the minimum-possible average search time of a binary search tree with these keys?