uiz Space

May 2024 term · Advanced Algorithms · BSCS4021

Advanced Algorithms Quiz 2: 4 August 2024 (May 2024 term)

The IIT Madras BS Advanced Algorithms (Advanced Algorithms) Quiz 2 paper sat on 4 Aug 2024, in the May 2024 term: 21 questions for 50 marks in 120 minutes. Every question is below with its answer. Take it as a timed mock test to be marked, or read it through first.

Questions
21
Marks
50
Duration
120 min
MCQ
19
MSQ
2

Updated

Official paper: IIT M DEGREE AN EXAM QDB2 4 Aug 2024 · No negative marking.

Question 1

+2 marksOne correct option

Based on the above data, answer the given subquestions.

Consider the following graph. A triangle-free subset of seven vertices is highlighted. Find the size of the largest triangle-free subset of vertices in this graph.

  1. A

    7

  2. B

    8

  3. C

    9

  4. D

    10

Show answer

Correct answer

  • B

    8

Question 2

+3 marksOne or more correct options

Based on the above data, answer the given subquestions.

The TRIANGLE-FREEDOM problem is the following: the input is a simple undirected graph G and a positive integer k. An instance (G, k) is a YES-instance if and only if G has a subset S of at least k vertices that are triangle-free.
What can you say about TRIANGLE-FREEDOM? Check all that apply.

Select all that apply.

  1. A

    It is in P.

  2. B

    It is in NP.

  3. C

    It is NP-hard.

  4. D

    It is NP-complete.

Show answer

Correct answers

  • B

    It is in NP.

  • C

    It is NP-hard.

  • D

    It is NP-complete.

Question 3

+3 marksOne correct option
  1. A

    Finding a Hamiltonian cycle in a graph is as hard as determining the answer to the Marbles Elimination question; i.e, there is a reduction from the problem of Marbles Elimination to the problem of finding a Hamiltonian cycle.

  2. B

    Determining the answer to the Marbles Elimination question is as hard as finding a Hamiltonian cycle in a graph; i.e, there is a reduction from the Hamiltonian cycle problem to the problem of Marbles Elimination.

  3. C

    Marbles Elimination is in P by a reduction to the Max Flow problem.

Show answer

Correct answer

  • B

    Determining the answer to the Marbles Elimination question is as hard as finding a Hamiltonian cycle in a graph; i.e, there is a reduction from the Hamiltonian cycle problem to the problem of Marbles Elimination.

Question 4

+3 marksOne correct option

Recall the max-flow problem: for a directed graph G(V,E)G(V, E) with non-negative capacities cec_e for every e∈Ee \in E and two special vertices ss (source, with no incoming edges) and tt (sink, with no outgoing edges), a flow in GG is an assignment f:E→R≥0f : E \rightarrow \mathbb{R}_{\geq 0} such that fe≤cef_e \leq c_e for every edge and for every vertex v∈V,∑(u,v)∈Ef((u,v))=∑(v,u)∈Ef((v,u))v \in V, \sum_{(u,v) \in E} f((u,v)) = \sum_{(v,u) \in E} f((v,u)). The task is to find a maximum flow ff i.e., a flow ff such that ∑(s,u)∈Ef((s,u))\sum_{(s,u) \in E} f((s,u)) is maximized.

Given an instance (G;s,t,c)(G; s, t, c), we attempt here to design a LP whose optimal value is equal to the maximum flow in the graph GG. There is a variable xuvx_{uv} for all (u,v)∈E(u, v) \in E. Note that for any pair of vertices that is not an edge, we do not introduce any variable corresponding to it.

max⁡∑uxut∀e=(u,v)∈E,xuv⩽ce∀v∉{s,t},∑uxuv=∑wxvw∀e=(u,v)∈E,xuv⩾0\begin{aligned} &\max \sum_u x_{ut} \\ &\forall e = (u,v) \in E, x_{uv} \leqslant c_e \\ &\forall v \notin \{s,t\}, \sum_u x_{uv} = \sum_w x_{vw} \\ &\forall e = (u,v) \in E, x_{uv} \geqslant 0 \end{aligned}

Is the LP above a valid formulation for computing the maximum flow in GG?

  1. A

    Yes, this is a valid set of constraints.

  2. B

    No, the sum in the objective function should be taken only over neighbors of u.

  3. C

    No, the sum in the second constraint should be taken only over in-neighbors of v and out-neighbors of v, respectively.

Show answer

Correct answer

  • A

    Yes, this is a valid set of constraints.

Question 5

+3 marksOne correct option
  1. A

    Statement 1

  2. B

    Statement 2

  3. C

    Both statements

  4. D

    Neither statements

Show answer

Correct answer

  • D

    Neither statements

Question 6

+2 marksOne correct option

Consider the following statements and answer the given subquestions if they are true or false.

The worst-case running time and expected running time are equal to within constant factors for any randomized algorithm.

  1. A

    TRUE

  2. B

    FALSE

Show answer

Correct answer

  • B

    FALSE

Question 7

+2 marksOne correct option

Consider the following statements and answer the given subquestions if they are true or false.

An adversary can provide randomized quicksort with an input array of length nn that forces the algorithm to run in ω(nlg⁡n)\omega(n \lg n) time on that input. (If you are not familiar with the ω\omega asymptotic notation, it roughly translates as “at least’ ’. For example, we can say that it is possible to come up with an input that forces insertion sort to run for ω(n2)\omega(n^2) steps.)

  1. A

    TRUE

  2. B

    FALSE

Show answer

Correct answer

  • B

    FALSE

Question 8

+3 marksOne or more correct options

Select all that apply.

  1. A

    It is in P.

  2. B

    It is in NP.

  3. C

    It is NP-hard.

  4. D

    It is NP-complete.

Show answer

Correct answers

  • A

    It is in P.

  • B

    It is in NP.

Question 9

+2 marksOne correct option

Recall that in the vertex cover problem, we are trying to find a smallest subset SS of vertices in a graph GG such that G∖SG \setminus S is an independent set; in other words, for every edges (u,v)(u, v) in the graph GG, we have that {u,v}∩S\{u, v\} \cap S is non-empty.

Consider the algorithm that repeats the following steps as long as the graph has at least one edge available: select a vertex of maximum degree (say ww), and include ww in the solution; thereafter, delete ww and all edges incident to ww.

Based on the above data, answer the given subquestions.

Is it true that the algorithm always outputs a vertex cover?

  1. A

    Yes

  2. B

    No

Show answer

Correct answer

  • A

    Yes

Question 10

+2 marksOne correct option

Recall that in the vertex cover problem, we are trying to find a smallest subset SS of vertices in a graph GG such that G∖SG \setminus S is an independent set; in other words, for every edges (u,v)(u, v) in the graph GG, we have that {u,v}∩S\{u, v\} \cap S is non-empty.

Consider the algorithm that repeats the following steps as long as the graph has at least one edge available: select a vertex of maximum degree (say ww), and include ww in the solution; thereafter, delete ww and all edges incident to ww.

Based on the above data, answer the given subquestions.

Consider the algorithm in the given question. Does the algorithm always output an optimal vertex cover?

  1. A

    Yes

  2. B

    No

Show answer

Correct answer

  • B

    No

Question 11

+2 marksOne correct option

Recall that in the vertex cover problem, we are trying to find a smallest subset SS of vertices in a graph GG such that G∖SG \setminus S is an independent set; in other words, for every edges (u,v)(u, v) in the graph GG, we have that {u,v}∩S\{u, v\} \cap S is non-empty.

Consider the algorithm that repeats the following steps as long as the graph has at least one edge available: select a vertex of maximum degree (say ww), and include ww in the solution; thereafter, delete ww and all edges incident to ww.

Based on the above data, answer the given subquestions.

Consider the algorithm in the given question. Does the algorithm always output a 2-approximate vertex cover?

  1. A

    Yes

  2. B

    No

Show answer

Correct answer

  • B

    No

Question 12

+1 markOne correct option

Recall that in the vertex cover problem, we are trying to find a smallest subset SS of vertices in a graph GG such that G∖SG \setminus S is an independent set; in other words, for every edges (u,v)(u, v) in the graph GG, we have that {u,v}∩S\{u, v\} \cap S is non-empty.

Consider the algorithm that repeats the following steps as long as the graph has at least one edge available: select a vertex of maximum degree (say ww), and include ww in the solution; thereafter, delete ww and all edges incident to ww.

Based on the above data, answer the given subquestions.

Recall that the size of an optimal vertex cover is at most twice the size of a maximum matching of a graph G. Are there examples of graphs where the size of the optimal vertex cover is exactly equal to twice the size of its maximum matching? For example, this is not true for a path on three vertices: the size of both the maximum matching and minimum vertex cover is 1.

  1. A

    Yes

  2. B

    No

Show answer

Correct answer

  • A

    Yes

Question 13

+2 marksOne correct option

Based on the above data, answer the given subquestions.

  1. A

    TRUE

  2. B

    FALSE

Show answer

Correct answer

  • A

    TRUE

Question 14

+3 marksOne correct option

Based on the above data, answer the given subquestions.

  1. A

    TRUE

  2. B

    FALSE

Show answer

Correct answer

  • A

    TRUE

Question 15

+3 marksOne correct option

Based on the above data, answer the given subquestions.

  1. A

    TRUE

  2. B

    FALSE

Show answer

Correct answer

  • B

    FALSE

Question 16

+2 marksOne correct option

Based on the above data, answer the given subquestions.

The construction described here is a valid reduction from 3-SAT to 3-Coloring.

  1. A

    TRUE

  2. B

    FALSE

Show answer

Correct answer

  • B

    FALSE

Question 17

+2 marksOne correct option

Based on the above data, answer the given subquestions.

The construction described here is a valid reduction from 3-Coloring to 3-SAT.

  1. A

    TRUE

  2. B

    FALSE

Show answer

Correct answer

  • B

    FALSE

Question 18

+2 marksOne correct option

Based on the above data, answer the given subquestions.

Argue that to solve SCS, it is sufficient to find:

  1. A
  2. B
  3. C
Show answer

Correct answer

  • A

Question 19

+3 marksOne correct option

Based on the above data, answer the given subquestions.

Observe that for a given π\pi, the length of the corresponding superstring s(π)s(\pi), which is obtained by writing the input strings in the order (sπ(1),…,sπ(n))\left(s_{\pi(1)}, \ldots, s_{\pi(n)}\right) and merging adjacent strings, is given by:

∣s(π)∣=∑i=1n∣si∣−∑i=1n−1∣ov(sπ(i),sπ(i+1))∣.|s(\pi)| = \sum_{i=1}^{n} |s_i| - \sum_{i=1}^{n-1} \left|\text{ov}\left(s_{\pi(i)}, s_{\pi(i+1)}\right)\right|.

The compression of π\pi is the sum of the overlaps of adjacent strings in the permutation π\pi. Finding a shortest superstring is equivalent to:

  1. A
  2. B
  3. C
Show answer

Correct answer

  • A

Question 20

+3 marksOne correct option

Based on the above data, answer the given subquestions.

We define an overlap graph OG(S)OG(\mathcal{S}) associated with S\mathcal{S} as follows: OG(S)OG(\mathcal{S}) is a complete directed graph (V,E)(V, E) (that is, for every s,t∈Vs, t \in V there are edges (s,t)(s, t) and (t,s)(t, s)), where V=SV = \mathcal{S}, and the weight of an edge (s,t)(s, t) is ∣ov(s,t)∣|\text{ov}(s, t)|.

Let us say that an edge (u,v)(u, v) dominates another edge (u′,v′)(u', v'), if they share head or tail (that is, u=u′u = u' or v=v′v = v') and ∣ov(u,v)∣⩾∣ov(u′,v′)∣|\text{ov}(u, v)| \geqslant |\text{ov}(u', v')|.

In terms of the overlap graph, the greedy algorithm goes through a list of all edges in OG(S)OG(\mathcal{S}) in the nonincreasing order of their overlap and includes some of them in a solution. Specifically, the greedy algorithm does not include another edge if and only if

R1. it is dominated by an already chosen edge,
R2. it is not dominated but it would form a cycle.

What is the structure of the set of edges returned by the greedy algorithm?

  1. A

    A Hamiltonian cycle, i.e, a cycle that visits every vertex in the graph exactly once

  2. B

    A Hamiltonian path, i.e, a path that visits every vertex in the graph exactly once

  3. C

    A regular graph, i.e, a graph where every vertex has the same degree

Show answer

Correct answer

  • B

    A Hamiltonian path, i.e, a path that visits every vertex in the graph exactly once

Question 21

+2 marksOne correct option

Based on the above data, answer the given subquestions.

Does the greedy algorithm always produce the right answer?

  1. A

    Yes

  2. B

    No

Show answer

Correct answer

  • B

    No