lecture5 - AlgorithmComplexityAnalysis (Chapter10.4)...

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

View Full Document Right Arrow Icon
Algorithm Complexity Analysis  (Chapter 10.4) Dr. Yingwu Zhu
Background image of page 1

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

View Full DocumentRight Arrow Icon
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
Background image of page 2
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!!!
Background image of page 3

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

View Full DocumentRight Arrow Icon
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
Background image of page 4
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
Background image of page 5

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

View Full DocumentRight Arrow Icon
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 … 
Background image of page 6
Image of page 7
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 28

lecture5 - AlgorithmComplexityAnalysis (Chapter10.4)...

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

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