0% found this document useful (0 votes)
43 views2 pages

Algo Assignment

The document is an assignment for a Design and Analysis of Algorithms course. It contains two questions asking students to solve 10 recurrence relations each using iterative substitution or recursive trees, and validate the solutions using the Master Theorem. Students are asked to solve recurrences involving functions like n^3, n^2, n log n, sqrt(n), and expressions combining recursive calls and other terms. They must provide the closed form expression for each recurrence and check it against the Master Theorem.

Uploaded by

Rida Tariq
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)
43 views2 pages

Algo Assignment

The document is an assignment for a Design and Analysis of Algorithms course. It contains two questions asking students to solve 10 recurrence relations each using iterative substitution or recursive trees, and validate the solutions using the Master Theorem. Students are asked to solve recurrences involving functions like n^3, n^2, n log n, sqrt(n), and expressions combining recursive calls and other terms. They must provide the closed form expression for each recurrence and check it against the Master Theorem.

Uploaded by

Rida Tariq
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/ 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