3cs1109 Ir Rpr December 2019
3cs1109 Ir Rpr December 2019
Institute of Technology
Semester End Examination (IR/RpR), December - 2Ol9
M. Tech- in computer science and Engineering, semester-r
I
I\'I. Tech. in computer science and Engineering (lNS), Semester-I
/
IrI. Tech. irr compr.rter Science and Engineering (Data science), semester-l
3CS1109 Complexity Theory and Algorithms
l4ai( Marks: 1oo Time: 3 HOURS
Roll No. Supervisor's
initial with date
Instructions: 1. Attempt all questions.
2. Figures to right indicate full marks.
3. Draw neat sketches wherever necessary.
4. Assume suitable data wherever necessary and specify clearly.
5. Use section wise separate answerbooks.
SECTION I
Q1 Answer the following
[17]
CO1, A. Formally define various complexity classes viz. p, Np, Np-
L1, COMPLETE and NP-HARD and discuss importance of these tgl
L2 classes in context of algorithmic complexity ih.ory.
B. Solve follorving recurrences (anv onel tSI
1. t(n):St(n-l )-6t(n-2), if n>=2,
t(n)=n, if n=O or n=7
2. t(n1=n1z(n/2), If n>=2,
t(n):l/ 3, if n=l
C. solve following recurrences either by using Master,s Theorem
or by using Extended Master,s theorem Lppropriately {any t4I
onel. (Answer should be asymptotically tighf Uorrra.l
1. t(n): 2t(n/ fl* trn
2. t(n)= 9t(n/3)+ n2/log2 n
Q2 Answer the following
lLTl
CO3, A. Develop an algorithm (with time complexity @N") to find all
L6 tgl
divisors of a number n.
B' Develop a recursive algorithm for Bubble Sort (iterations not to
be used at all ) and trace it on suitable example with 6 tgl
numbers.
Q3 Answer the following
[16]
CO2, A. Using Limit rules prove that
lBl
L3 2n2 +3n logs n +5n : O(nt)
B' For an efficient implementation of Kruskal,s Algorithm (for [gl
minimum spanning tree), which is the most suitabie data
structure to detect cycle. Justify your answer with a suitable
example and give proper compledty analysis.
Page I of3
3csttol
SECTION II
Q4 Answer the following
co3, A. Write Merge Sort algorithm and analyse its complexity for all [16]
co 1, the possible scenarios. t8l
L4 B. Develop an algorithm to solve. 0/ 1 Knapsack probrem using
Greedy Strategr. Trace your argorithm on forlowing data f* tg]
knapsack capacitg= 5, to maximise the varue in knapsack:
-l J 4
3 4 5
-- 4 5 il 6
Page 2 of3
3cs)lo9
B. use Hungarian Algorithm and sorve the following exampie
where four jobs (Jr, J2, J3, and J4) need to be executed tB]
by four
workers (W1, W2, W3, and W4), onejob per worker. The matrix
below shows the cost of assigning a certlin worker to a certain
job. The objective is to minimize the total cost of the
assignment. (Complete trace expected).
J1 J2 J3 J4
w] 82 83 69 92
w2 77 37 49 92
w3 11 695 86
w4 8 998 23
OR
B. use Backtracking Technique and write an algorithm to sorve
B-queen puzzle problem, arso evaluate its tinie comprexity. IB]
************** ****
Page 3 of3