Anda di halaman 1dari 13

Friday, 07 October

2016

Launchpad
Lecture -11

Time Complexity

Prateek
Narang
2 Friday, 07 October 2016

Doubts ?
3 Friday, 07 October 2016

Order Complexity Analysis

Amount of time/space taken by the algorithm


to run as a function of the input size
4 Friday, 07 October 2016

Experimental Analysis

 Selection Sort vs Merge Sort


5 Friday, 07 October 2016

Theoretical Analysis

 Bubble Sort
 Binary Search
 Factorial
 Polynomial Evaluation
6 Friday, 07 October 2016

Your turn

 Insertion
sort
 Fibonacci
 Assignment 3 and assignment 4 solutions
7 Friday, 07 October 2016

Complexity Analysis Examples

for (i=0; i<=n-1; i++){


for (j=i+1; j<=k; j++){
constant number of operations.
}
}
8 Friday, 07 October 2016

Complexity Analysis Examples

for (i=0; i<=n-1; i++){


for (j=i+1; j<=n; j++){
constant number of operations.
}
}
9 Friday, 07 October 2016

Complexity Analysis Examples

for (i=0; i<=n-1; ){


for (j = 0; j<k; j++){
constant number of operations.
}
i = i + j;
}
10 Friday, 07 October 2016

What is space complexity?


11 Friday, 07 October 2016

What in case of recursion?


12 Friday, 07 October 2016

Lets go through the


assignments
13 Friday, 07 October 2016

Thank You!

Prateek Narang
prateek@codingblocks.com