Daa Assignment
Daa Assignment
Answer ALL questions. All parts of the questions must be answered at one place only
SECTION – A
1 Determinethe frequencycountsfor allstatementsin the following two CO1 BL3
Algorithmsegments
fori :=1to n do : i = 1;
forj :=1to ido: while (i ≤ n) do{
fork :=1to jdo : x= x + 1;
x :=x+1; i = i + 1;
}
(a) (b)
2 Notate following functions using asymptotic Notations. CO1 BL3
i) 2n22n +nlognii) n2n+ 6 * 2n
iii)10n3+ 15n4+100 n22niv) n! + nn + logn
3 Find the time complexity of function T(n) = 2T(n/2) + n using Masters CO1 BL3
3
theorem
4 a) Write Control abstraction for Divide and Conquer method CO1 BL2
b) Explain Theta Ɵ Notation using example CO1 BL2
6 Explain the Master's Theorem for solving recurrence relations of decreasing CO1 BL3
function and write complexity for T(n) = 2T(n-2) + nlogn
7. Solve the following 0/1 knapsack problem to fill a bag with 4 objects in which
capacity of the bag 8 and (p1,p2,p3,p4)={1,2,5,6) (w1,w2,w3,w4)={2,3,4,5} CO2 BL2
8. Differentiate Greedy approach and Dynamic approach of solving problems. CO2 BL2