





























Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!






























Asymptotic Analysis Instructor: George Bebis (Chapter 3, Appendix A)
c 1 +c 1 +...+c 1 = c 1 x N (N+1) x c 2 + N x c 1 = (c 2 + c 1 ) x N + c 2
1
2
2
3
1
2
2
3
2
4
2
4
4
2
4
f A ( n )=30 n + Increasing n f B ( n )= n 2
Value of function
2
4
2
3
3
Algorithm 3 Cost sum = 0; c 1 for(i=0; i<N; i++) c 2 for(j=0; j<N; j++) c 2 sum += arr[i][j]; c 3
c 1
- (^) 2n^2 = O(n^3 ): - n 2 = O(n 2 ): - (^) 1000n^2 +1000n = O(n^2 ): - (^) n = O(n^2 ): 2n 2 ≤ cn 3 2 ≤ cn c = 1 and n 0
n 2 ≤ cn 2 c ≥ 1 c = 1 and n 0
_1000n 2 +1000n ≤ 1000n 2
2
0