Lecture 13 - Algorithm Analysis

Lecture 13 - Algorithm Analysis - Algorithm Analysis EEE 13...

Info iconThis preview shows pages 1–9. Sign up to view the full content.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Algorithm Analysis EEE 13 Lecture 02 Algorithm Analysis ● Considers how Input affects the performance of the algorithm ● Usual Criteria – Processing Time – Memory Usage – Other resources Empirical Approach ● Actual – Measures performance in use ● Random data – Generic approach, may not be representative ● Perverse data – Attempt worst case analysis Theoretical Approach ● Study the following cases: – worst case performance – Average performance – Best case performance ● Independent of actual implementation Growth of functions ● Often we simply study how the run time T depends on the input size N ● Time is usually associated to the number of operations ● T = f(N) – N might be ● degree of polynomial ● file size ● number of char in a text string ● etc. /* Assuming each operation takes 1 unit of time */ int func1( int aList[ ], int N) { int iSum; int i; iSum = ; /* 1 */ i = ; /* 1 */ while( i < N) { /* N+1 */ iSum += aList[i]; /* 3N */ i ++ ; /* N */ } return iSum; /* 1 */ } /* f(N) = 5N + 4 */ /* Assuming each operation takes 1 unit of time */ void func2( int aList[ ], int N) { int iSum; int i; int j; for (i = ; i < N; i ++ ) { /* 1+N+1+N = 2N+2 */ for (j = ; j < N; j ++ ) /* N*(2N+2) */ printf( “%d\n” , aList[j] * aList[i]); /* N*(4N) */ } } /* f(N) = 6N 2 + 4N + 2 */ Big Oh ● We use the O-notation to allow us to classify algorithms according to upper bounds on their total running times...
View Full Document

Page1 / 26

Lecture 13 - Algorithm Analysis - Algorithm Analysis EEE 13...

This preview shows document pages 1 - 9. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online