0% found this document useful (0 votes)
54 views3 pages

Unit-1 Assignment-1-Questions

The document contains questions related to analyzing algorithms and determining their time complexities. Specifically, it asks the reader to: 1. Use step counting and asymptotic notations to find the time complexities of code segments. 2. Determine if certain functions are asymptotically bounded above by others using Big O notation. 3. Solve recurrence relations using substitution and recurrence tree methods to determine algorithm time complexities. 4. Apply the master theorem to solve recurrence relations.

Uploaded by

Merlin Linda G
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
54 views3 pages

Unit-1 Assignment-1-Questions

The document contains questions related to analyzing algorithms and determining their time complexities. Specifically, it asks the reader to: 1. Use step counting and asymptotic notations to find the time complexities of code segments. 2. Determine if certain functions are asymptotically bounded above by others using Big O notation. 3. Solve recurrence relations using substitution and recurrence tree methods to determine algorithm time complexities. 4. Apply the master theorem to solve recurrence relations.

Uploaded by

Merlin Linda G
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

SRM INSTITUTE OF SCIENCE AND TECHNOLOGY

VADAPALANI CAMPUS
DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING
18CSC204J- DESIGN AND ANALYSIS OF ALGORITHMS
Part Time
Assignment-1 from Unit-1
Questions
1. Apply step count method and analyze the algorithm segment. Find the time
complexity also
a.

b.

c.

2. Perform Time Complexity Analysis using Operation Count


a).
int sum (int a[], int n)
{
int sum=0;
for(int=0; i<n;i++)
sum+=a[i];
return sum;
}

b).
void transpose (int **a, int n)
{
for(int i =0;i<n;i++)
for(int j=j+1;j<n;j++)
swap(a[i][j],a[j][i]);
}

3. Apply Asymptotic Notations and find the positive constants c and n0 for
different cases. Given below

a.
b.
c.
d.
e.
f.
g.
h.
i. 3n2 - 100n + 6 = (n3)

4. What does it mean if: f(n)  O(g(n)) and g(n)  O(f(n)) ?


5. Is 2n+1 = O(2n) ?
6. Is 22n = O(2n) ?
7. Does f(n) = O(f(n)) ?
8. If f(n) = O(g(n)) and g(n) = O(h(n)), can we say f(n) = O(h(n)) ?

9. What is the recurrent equation for the sequence 3,9,27,81,…


10. Solve the recurrence relation using substitution method
a. Use forward substitution
T(n)=2T(n-1)+1 for n>1
T(1)=1
b. Use backward substitution
T(n)=T(n-1)+n for n>0
T(0)=1

11. Solve the recurrence relation using recurrence tree method


T(n)=2T(n/2)+4n, T(1)=4

12. Apply master theorem to solve the following equation

a. T(n)=9T(n/3)+n
b. T(n) = T(2n/3)+1

You might also like