## All Weeks Advanced Algorithms and Complexity Coursera Quiz Answers

In previous courses of our online specialization you’ve learned the basic algorithms, and now you are ready to step into the area of more complex problems and algorithms to solve them. Advanced algorithms build upon basic ones and use new ideas.

We finish with a soft introduction to streaming algorithms that are heavily used in Big Data processing. Such algorithms are usually designed to be able to process huge datasets without being able even to store a dataset.

### Advanced Algorithms and Complexity Coursera Quiz Answers

#### Week 1: Flow Algorithms

Q1. Which vertices are in the minimum S-T cut in the network below?

**A****B****C****D****E****S****T**

Q2. What is the augmenting path that will be used by the Edmonds-Karp algorithm to increase the flow given below?

- S-A-C-T
- S-B-A-C-D-T
- S-B-D-C-T
**S-B-A-C-T**- S-B-T

Q3. Which of the statements below is true?

**The sum of the capacities of the edges of a network equals the sum of the capacities of the edges of any residual network.****The Ford-Fulkerson algorithms runs in polynomial time on graphs with unit edge capacities.****The Edmonds-Karp algorithm is always faster than the Ford-Fulkerson algorithm.**

Q4. What is the size of the maximum matching of the following graph?

Answers: 4

Q5. Consider the image segmentation problem on a picture that is given by an n by n grid of pixels. Suppose that separation penalties are imposed only for adjacent pairs of pixels. If we use the Edmonds-Karp algorithm to solve this problem as described in class, the final runtime is O(n^a) for some a. What is the best such a?

Answer : 5

#### Week 2: Linear Programming Quiz

Q1. What is the minimum number of linear inequalities needed to define the figure pictured below?

Answer: 8

Q2. Given a solution to a linear program, one could try to show that it is optimal by finding a matching solution to the dual program. Which of the following theorems will make it easier to do so?

- Separation of convex sets from outside points by hyperplanes.
**Complementary slackness.**- Polytopes achieve optimum values at vertices.

Q3. Which of the following statements are true?

- A system of linear equations has a solution unless they can be combined in some combination to give the equation 0=1.
**A system of linear equations has always 0, 1, or infinitely many solutions.****A system of n linear equations in n variables always has a unique solution.**

Q4. Suppose that you are trying to solve the optimization problem:

Maximize v\cdot xv⋅x subject to Ax \geq bAx≥b for some A\in \mathbb{R}^{m\times n}A∈R

m×n

(i.e. trying to solve an optimization problem in nn variables with mm linear inequality constraints).

This problem can be reduced to running a solution finding algorithm on a different system of linear equations in kk variables. What is the smallest value of kk for which this can be done?

Preview will appear here…

Answers : K=0

Q5. What is the largest possible value of x+y achievable by pairs x,y of real numbers satisfying the constraints:

- x <= 7
- y <= 10
- 2x+y <= 21
- -x + 2y <= 12
- 5x-y <= 30

Answers : 15

#### Week 3: NP-complete Problems

Q1. How many satisfying assignments does the following formula have?

(*x*1∨*x*2∨*x*3)(*x*1∨*x*2)(*x*1∨*x*2)

Answers : 3

Q2. How many integer solutions does the following linear program have?

*x*1≥0,*x*2≥0,4*x*1+3*x*2≤12,3*x*1+5*x*2≤15

Answers : 10

Q3. Consider the following graph:

It has 6 different independent sets: empty set, {A}{A}, {B}{B}, {C}{C}, {A, C}{A,C}, {B, C}{B,C}.

How many different independent sets does the following graph have?

Answers : 7

Q4. In the 3-coloring problem, you are given an undirected graph and the goal is to assign one of three available colors to its vertices such that the ends of each edge of the graph receive different colors. This is clearly a search problem: given a graph and a coloring of its vertices, one can check in polynomial time whether there are only three different colors and that no edge is monochromatic. This problem is known to be NP-complete. Do we have a polynomial time algorithm for this problem?

**This is an open problem.**- No, this problem cannot be solved in polynomial time for sure.
- Yes, this problem can be solved in polynomial time.

Q5. In the lectures, we constructed a reduction from 3-SAT to Independent Set. Now, we show the reverse reduction. For this, we are going to reduce Independent set to SAT. We can then use the fact that SAT reduces to 3-SAT.

In the Independent Set problem we are given a graph G*G* with n*n* vertices \{1,2,\dotsc,n\}{1,2,…,*n*} and a positive integer b*b*. Our goal is to check whether the graph has b*b* vertices \{u_1,u_2,\dotsc,u_b\} \subseteq \{1,2,\dotsc,n\}{*u*1,*u*2,…,*u**b*}⊆{1,2,…,*n*} with no edge between any pair of them. We are going to construct a CNF formula F*F* that is satisfiable if and only if the graph G*G* contains such an independent set. There will be bn*b**n* Boolean variables: for 1 \le i \le b1≤*i*≤*b* and 1 \le j \le n1≤*j*≤*n*, x_{ij}=1*x**i**j*=1 if and only if the i*i*-th vertex of the required independent set is the j*j*-th vertex of the graph (that is, u_i=j*u**i*=*j*).

We then introduce the following constraints:

*u**i* is equal to some vertex of the graph: for all 1 \le i \le b1≤*i*≤*b*, (x_{i1} \lor x_{i2} \lor \dotsb \lor x_{in})(*x**i*1∨*x**i*2∨⋯∨*x**i**n*);- u_i
*u**i* is equal to exactly one vertex of the graph: for all 1 \le i \le b1≤*i*≤*b*and all 1 \le j \neq j’ \le n1≤*j*=*j*′≤*n*, (\overline x_{ij} \lor \overline x_{ij’})(*x**i**j*∨*x**i**j*′); - u_i \neq u_{i’}
*u**i*=*u**i*′: for all 1 \le i \neq i’ \le b1≤*i*=*i*′≤*b*and all 1 \le j \le n1≤*j*≤*n*, (\overline x_{ij} \lor \overline x_{i’j})(*x**i**j*∨*x**i*′*j*); - no two vertices from the independent set are joined by an edge: for all 1 \le i\neq i’ \le b1≤
*i*=*i*′≤*b*and all \{j,j’\} \in E(G){*j*,*j*′}∈*E*(*G*), (\overline x_{ij} \lor \overline x_{i’j’})(*x**i**j*∨*x**i*′*j*′)

The resulting formula is satisfiable if and only if the initial graph has an independent set of size

Is this reduction correct?

- No, it is not correct, because it is not a polynomial time reduction.
- No, it is not correct, because for a graph that does not have an independent set of size bb it might produce an a satisfiable formula.
**Yes, the reduction is correct.**- No, it is not correct, because it might produce an unsatisfiable formula for a graph that has an independent set of size bb.

Q6. How many satisfying assignments does the following circuit have?

Answers : 3

#### Quiz 4: Coping with NP-completeness

Q1. What is the weight of a minimum traveling salesman cycle in the following graph?

**Answers: 110**

Q2. Recall that the dynamic programming algorithm for the traveling salesman problem uses O(n^2 \cdot 2^n)*O*(*n*2⋅2*n*) time and O(n \cdot 2^n)*O*(*n*⋅2*n*) space (as usual, n*n* is the number of vertices). You are going to run this algorithm on a graph with 50 vertices. Roughly how much space is needed for this assuming that each cell of the dynamic programming table occupies 8 bytes? (See How much is 1 megabyte, gigabyte, etc?)

- Kilobyte
- Megabyte
- Gigabyte
- Terabyte
- Petabyte
**Exabyte**- Zettabyte
- Yottabyte

Q3. What is the maximum size of an independent set in the following tree?

**Answers : 10**

#### Week 5: Heavy Hitters

Q1. What is the set of top 2 most frequent items in the following stream?

125311244333

- 1 2
**1 3**- 4 5

Q2. Suppose that we would like to use Chebyshev’s inequality to bound \operatorname{Prob}[|X|\geq 3]Prob[∣*X*∣≥3], where X*X* is a normally distributed random variable with unit variance. Chevyshev’s inequality gives

- Prob[∣
*X*∣≥3]≤1/3 - Chebyshev’s inequality does not apply to this setting
**Prob[∣***X*∣≥3]≤1/9

Q3. Suppose that we would like to use Chebyshev’s inequality to bound \operatorname{Prob}[|X|\geq 3]Prob[∣*X*∣≥3], where X*X* is a random variable with the Cauchy distribution, i.e. the p.d.f. of X*X* is \frac{1}{\pi(1+x^2)}*π*(1+*x*2)1. Chevyshev’s inequality gives

- Prob[∣
*X*∣≥3]≤1/3 **Chebyshev’s inequality does not apply to this setting**- Prob[∣
*X*∣≥3]≤1/9

Q4. Suppose that the stream contains items 1 with frequency N^{\alpha}*Nα* for a constant \alpha<1/2*α*<1/2, and all other elements appear in the stream exactly once. How much space suffices for CountSketch to find the most frequent element in this stream?

*O*(*n*1−2*α*log*n*)*O*(*nα*log*n*)*O*(*n*1−4*α*2log*n*)

Q5. Suppose that we would like to use Markov’s inequality to bound \operatorname{Prob}[X\geq 3]Prob[X≥3], where XX is a normally distributed random variable with unit variance. Markov’s inequality gives

- Prob[
*X*≥3]≤1/9 - Prob[
*X*≥3]≤1/3 **Markov’s inequality does not apply to this setting**

##### Advanced Algorithms and Complexity Coursera Course Review:

In our experience, we suggest you enroll in Advanced Algorithms and Complexity courses and gain some new skills from Professionals completely free and we assure you will be worth it.

Advanced Algorithms and Complexity course is available on Coursera for free, if you are stuck anywhere between quiz or graded assessment quiz, just visit Networking Funda to get Advanced Algorithms and Complexity Coursera Quiz Answers.

##### Conclusion:

I hope this Advanced Algorithms and Complexity Coursera Quiz Answers would be useful for you to learn something new from this Course. If it helped you then don’t forget to bookmark our site for more Coursera Quiz Answers.

This course is intended for audiences of all experiences who are interested in learning about new skills in a business context; there are no prerequisite courses.

Keep Learning!

#### Get All Course Quiz Answers of Data Structures and Algorithms Specialization

Algorithmic Toolbox Coursera Quiz Answers

Data Structures Coursera Quiz Answers

Algorithms on Graphs Coursera Quiz Answers

Algorithms on Strings Coursera Quiz Answers

Advanced Algorithms and Complexity Coursera Quiz Answers

Genome Assembly Programming Challenge Coursera Quiz Answers