{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

lecture5

# lecture5 - (Chapter10.4 Dr.YingwuZhu efficiency...

This preview shows pages 1–7. Sign up to view the full content.

Algorithm Complexity Analysis  (Chapter 10.4) Dr. Yingwu Zhu

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

View Full Document
How to measure algorithm  efficiency? Space utilization : amount of memory required Time efficiency : amount of time required to  accomplish the task As space is not a problem nowadays Time efficiency is more emphasized But, in embedded computers or sensor nodes,  space efficiency is still important
Time efficiency Time efficiency depends on : size of input speed of machine  quality of source code quality of compiler These vary from one platform to another So, we cannot express time efficiency meaningfully in real  time units such as seconds!!!

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

View Full Document
Algorithm efficiency But, we can count the number of times  instructions are executed This gives us a measurement of efficiency of an  algorithm So we measure computing time  T(n)  as T(n)   = number of times the instructions are executed T(n): computing time of an algorithm for input of size n
Example: calculating a mean Task          # times executed 1. Initialize the  sum  to 0 1 2. Initialize index  i  to 0 1 3. While   i  <  n  do following       n+1 4.   a) Add x[i] to sum n 5.   b) Increment  i  by 1 n 6. Return  mean = sum/n 1              Total                                    3n + 4

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

View Full Document
As number of inputs increases T(n) = 3n + 4 grows at a rate proportional to  n Thus T(n) has the "order of magnitude"  n The  computing time  of an algorithm  on input  of size n,  T(n)  said to have  order of magnitude f(n) ,   written  T(n) is O(f(n))   if …
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### Page1 / 28

lecture5 - (Chapter10.4 Dr.YingwuZhu efficiency...

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

View Full Document
Ask a homework question - tutors are online