Why Does Performance Analysis Matter? - PowerPoint PPT Presentation

1 / 13
About This Presentation
Title:

Why Does Performance Analysis Matter?

Description:

Why Does Performance Analysis Matter? Check out the table of time complexity functions! Comparison of Time Complexity Functions Timings of Insert Timings of ... – PowerPoint PPT presentation

Number of Views:48
Avg rating:3.0/5.0
Slides: 14
Provided by: Paolo177
Category:

less

Transcript and Presenter's Notes

Title: Why Does Performance Analysis Matter?


1
Why Does Performance
Analysis Matter?
Check out the table of time complexity functions!
2
Comparison of Time Complexity Functions
10 20 30 40 50 60
n .00001second .00002second .00003second .00004second .00005second .00006second
n2 .0001second .0004second .0009second .0016second .0025second .0036second
n3 .001second .008second .027second .064second .125second .216second
n5 .1second 3.2seconds 24.3seconds 1.7minutes 5.2minutes 13.0minutes
2n .001second 1.0second 17.9minutes 12.7days 35.7years 366centuries
3n .059second 58minutes 6.5years 3855centuries 2x108centuries 1.3x1013centuries
3
Timings of Insert
4
Timings of Change Phase
5
Timings of Extract
6
Total Timings
7
Example A Messy Timing Function
  • Based on
  • using the Sorting_Machine to sort n items
  • selection sort used to implement the
    Sorting_Machine
  • tsel-sort(n) c1 n c2 c3 n (n1)/2

8
Simplify with Big-Oh Notation
  • Used to simplify the description of timing
    functions
  • DefinitionLet f integer?0 ? integer?0.
    Then,O(f) t integer?0 ? integer?0 where
    there are constants c gt 0 and
    m ? 0 such that t(n) ? c f(n) for
    all n ? m
  • When t is in O(f), we say t is O(f)

9
What Does t is O(f) Mean?

y
y 2f(n)
yt(n)
yf(n)
n
m
10
Big-Oh Continued
  • Is tsel-sort in O(n2)?
  • Is tsel-sort in O(n3)?
  • Is tsel-sort in O(n)?
  • Is tsel-sort in O(n log2(n))?

11
Some Important Timing
Functions
  • constant time c
  • log time c log n
  • linear time c n
  • n-log-n time c n log n
  • quadratic time c n2

12
Growth of Common Functions
2n
n3
n2
n logn
n
logn
c
13
Big-Oh Example Comparisons
of Running Times
Poor AlgorithmO(n2) Poor AlgorithmO(n2) BetterAlgorithmO(n logn)
Size ofProblem GoodImplement. PoorImplement. ?
n T(n)5n2 ms T(n)10n2 ms T(n)50 n logn ms
10 .0005 sec. .001 sec. .002 sec.
100 .05 sec. .1 sec. .03 sec.
1,000 5 sec. 10 sec. .5 sec.
10,000 8 min. 16 min. 6.6 sec.
100,000 14 hours 28 hours 83 sec.
1,000,000 58 days 116 days 17 min.
Write a Comment
User Comments (0)
About PowerShow.com