Algo Assignment

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 2

National University of Computer & Emerging Sciences, Karachi

Fall-2018 Department of Computer Science


Assignment # 2
th​
18​ September 2018, 12:00 pm

Course Code: ​CS302 Course Name: ​Design and Analysis of Algorithm


Instructor Name : ​Zeshan Khan

Instructions:

● In case of any ambiguity, you may make assumption. But your assumption should not
contradict any statement.

Max Marks​: 100 point (3 Mark)

Question # 1 [10*5=50 Marks]


A) For each of the following recurrences, give an expression for the runtime T (n) if the
recurrence can be solved with the Iterative Substitution.
B) Validate with the solution by Master Theorem results if possible by Master Theorem.

1. T (n) = 32T (n/2) + n3


2. T (n) = T (n/2) + n2
3. T (n) = 3T (n/2) + 2n
4. T (n) = nT (n/2) + n3
5. T (n) = 2n T (n/2) + nn
6. T (n) = 2nT (n/4) + n!
7. T (n) = 6T (n/2) + nlogn
8. T (n) = 2T (n/4) + n0.51
9. T (n) = √2T (n − 2) + log 2 n
10. T (n) = T (n − 1) + n

Question # 2 [10*5=50 Marks]


C) For each of the following recurrences, give an expression for the runtime T (n) if the
recurrence can be solved with the Recursive Tree.
D) Validate with the solution by Master Theorem results if possible by Master Theorem.

1. T (n) = T (n/3) + √n
2. T (n) = 4T (n − 2) + 103 n
3. T (n) = 3T (n/4) + 1
4. T (n) = 6T (n − 3) + n2 logn
5. T (n) = 4T (n/2) + n/logn
6. T (n) = 7T (n/3) + nlogn
7. T (n) = 4T (n * 2) + logn
8. T (n) = T (n + 2) + n(2 − cosn)
9. T (n) = √2T (n/2) + logn
10. T (n) = 5T (n/2) + 1

You might also like