You are on page 1of 1

Sarvajanik College of Engineering & Technology, Surat

Information Technology Department


BE III Year ( Semester V) AY-2019-20
2150703: Analysis and Design of Algorithms
Assignment: 01
1. Explain why analysis of algorithms is important?

2. Why do we use asymptotic notations in the study of algorithms? Briefly describe the
commonly used asymptotic notations mathematically and illustrate them graphically.

3. Let f(n) and g(n) be asymptotically positive functions. Prove or disprove following.
(1) f(n) + g(n) = Θ(min(f(n), g(n))).
(2) f(n) + g(n) = O(max(f(n), g(n))).

4. Find big oh(O), big theta(Θ) and big omega ( Ω) notation for following;
(1) f(n) =6993, (2) f(n) =6n2+135 (3) f(n) = 83n3 +84 n

5. Is 2n+1 = O (2n)? Explain

6. Prove that T (n) = 1+2+3+….+n = Θ(n2).

7. Prove the following


(a) f(n) = 2n2 is in O(n3 )
(b) f(n) = n2 + n is in O(n2 )
(c) f(n) = n/1000 is in O(n3 )
(d) f(n) = n2/100 is in Ω(n)
(e) f(n) = n2.001 n is in Ω (n2 )
(f) f(n) = n2-200n is in Ω (n)
(g) f(n) = n2/2-2n is in θ(n)

8. Arrange the following growth rate in increasing order:


n3, 1, n2,n, n!, n log(n), n2log(n), log(n), n0.5 , 2N

9. Give an analysis of the running time (Big-Oh notation) for each of the following program
fragments.
(a) (b)
sum = 0; sum = 0;
for(i=0;i<sqrt(n)/2;i++) for(i=1;i<2*n;i++)
sum++; for(j=1;j<i*i;j++)
for(j=0 ;j<sqrt(n)/4;j++) for(k=1;k<j;k++)
sum++; if (j % i)
for(k=0;k<8+j;k++) sum++;
sum++;

10. Analyze the following algorithms and specify the best-case, worst-case and average-case
complexity by assuming an input array of size N:
(1) Bubble sort (2) Selection Sort (3) Insertion Sort (4) Heap Sort
(5) Shell Sort (6) Counting Sort

You might also like