0% found this document useful (0 votes)
14 views4 pages

Compre

Uploaded by

harshraj0661
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
14 views4 pages

Compre

Uploaded by

harshraj0661
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

Design and Analysis of Algorithms (CS F364) Comprehensive Examination (Second Semester,

2024)
• This question paper has 4 printed pages with 6 questions in all and total marks (5 + 3 + 2) +
(8 + 2 + 8) + (8 + 8) + (14) + (1 + 4 + 10) + (2 + 1 + 1 + 1 + 4 + 1 + 4 + 1) = 88. Please show
all steps in computations or proofs with complete derivation of complexity results. This is an
open-book exam. You can use any printed or handwritten material restricted to the textbook,
reference books, and lecture notes. Calculators are allowed. Time: 180 minutes
• Algorithms should be written in standard English in either the form of Pseudocode, the
styles followed in textbooks or mathematical expressions. Time complexity and recurrence
relations are compulsory.
• Show each step and draw a diagram in pen-only with legibility/clarity. Write all subsequent
parts of a question together. Write “END” after your last answer. DON’T KEEP ANY PAGE
BLANK in between pages of the Answer booklet. Strike out if any such blank page exists at
the end of your answer/exam.
• Don’t unnecessarily copy the lecture slides/textbook / other study materials anywhere in the
answer booklet to avoid plagiarism. Marks might be deducted in such cases. Just cite the
reference of the resources used in your answer, if needed.
• Overwritten and illegible answers in any form will not be given full/partial credit and will
not be considered for RECHECKs. You can make necessary assumptions in case you need
to derive your solutions.
• Penalties will be as per AUGSD rules for any misconduct.
• GOOD LUCK!
1. (a) Solve the following scenario of the Fractional Knapsack problem: There are 5 items
(I1 , I2 , I3 , I4 , I5 ) with profit of the items given by (p1 , p2 , p3 , p4 , p5 ) = (15, 40, 32, 20, 30),
and weight of the items given by (w1 , w2 , w3 , w4 , w5 ) = (3, 4, 6, 2, 3). The knapsack ca-
pacity is W = 12. The loss for dividing any item into fractions is 2 units of the profit
made. Find out the maximum profit that can be made in this scenario.
(b) Is it possible to solve the Fractional Knapsack problem in linear time complexity? If
Yes, can you suggest an algorithm for the Fractional Knapsack problem with linear time
complexity? If No, why not?
(c) Solve the following reccurrence:
√ 
T (n) = 4T n + (log2 n)2 .

2. Integer Conversion by Rounding off a Matrix [Hint: Network Flow]


Consider the given matrix below in Table 1, whose elements are positive real numbers. The
sum of each row and each column is an integer. Prof. Stein wants to convert each element
into an integer by rounding off with either floor or ceiling value of the real element without
altering the sum of each row and column. For example, 10.8 can be converted into 10 or 11,
and 3.2 can be converted into 3 or 4.

1
C1 C2 C3 C4 Sum
R1 6.4 4.5 2.5 9.6 23.0
R2 2.1 1.3 8.6 4.0 16.0
R3 7.5 3.2 1.9 6.4 19.0
Sum 16.0 9.0 13.0 20.0 58.0
Table 1: Table for Question 2.

(a) Design an efficient algorithm to determine whether such an integer conversion by round-
ing off is possible. Determine the time complexity of your algorithm.
(b) Using your algorithm in part (a), derive the rounded matrix for the given example in
Table 1.

3. Maximize Team Effort [Hint: Dynamic Programming]


Prof. Rivest wants to make a team of four scholars to assist in his laboratory work, based
on the availability of the scholars in hours per week-day. The availability chart is shown in
Figure 1 at the LHS. He just quickly planned to select a cell (m, n) in the chart grid, which
divides the chart into four parts, like the four quadrants, where cell (m, n) : 1 < m < M, 1 <
n < N, where M is the number of rows and N is the number of columns. He selects one value
from each part with respect to the cell (m, n) excluding the m’th row and n’th column, i.e.,
based on the selected cell which divides the chart, shown as an example in Figure 1 at the
RHS. His objective is to maximize the value of the product of each of the four non-zero cells
that he selects.

Figure 1: Figure for Question 3.

(a) Design an efficient algorithm to solve his requirement to maximize the team’s product
value in O(MN) time. The top-left part is defined below, following which you can derive
the other parts. First part, top-left = { all cells (p, q)|p < m, q < n }.
(b) Using your algorithm in part (a), solve the given problem, which will maximize the
product value of the table shown in Figure 1.

2
4. By making use of efficient algorithms, find the last three (least significant) digits in the
decimal expansion of
20242024 .

5. Consider the algorithm RSAT (Algorithm 1) for solving the 3SAT problem:

Algorithm 1 RSAT(F)
i←1  t
3
while i ≤ 20 · do ▷ t is the number of clauses in F
2
Let F ′ be the set of 2-CNF and 1-CNF clauses in F
for Every 3-clause C = (l1 ∨ l2 ∨ l3 ) in F do ▷ l1 , l2 , l3 are literals
Randomly choose an l j (1 ≤ j ≤ 3)
Remove l j from C forming a new 2-clause C′
Add C′ to F ′
end for
Solve the resulting 2SAT instance F ′ in polynomial time, getting an assignment A
if A satisfies F then
return SAT
end if
i ← i+1
end while
return UNSAT

(a) Find the time complexity of RSAT.


(b) Determine (with proof) the type of randomized algorithm RSAT is: Las Vegas (zero-sided
error), Monte-Carlo (one-sided error), or Atlantic City (two-sided error).
(c) Derive the bounds on the error probability of RSAT (0 if it is a Las Vegas algorithm, one-
sided error bound p if it is a Monte-Carlo algorithm, two-sided error bounds p1 and p2
if it is an Atlantic City algorithm).

6. Consider the cycle graph Cn which is an undirected graph of n vertices V = { i | 1 ≤ i ≤ n }


with the set of edges E = { { i, j } | i − j = ±1( mod n) }.

(a) Find the minimum cardinality vertex cover for Cn , and also prove your result.
(b) Give an Integer Linear Programming formulation for the problem of finding the mini-
mum cardinality vertex cover for Cn .
(c) Convert your formulation in (b) into a Linear Programming formulation.
(d) Write the Dual Linear Program for the Linear Program in (c).
(e) Solve the Linear Program in (c), giving a proof that your solution is indeed optimal.
(f) Convert your solution in (e) into a vertex cover, giving the rule that you followed for the
conversion.

3
(g) Solve the Dual Linear Program in (d), giving a proof that your solution is indeed optimal.
(h) Convert your solution in (g) into a vertex cover, giving the rule that you followed for the
conversion.

You might also like