Download presentation
Presentation is loading. Please wait.
Published byMaría del Pilar Reyes Modified over 5 years ago
1
Algorithm Analysis T(n) O() Growth Rates 5/21/2019 CS 303 – Big ‘Oh’
Lecture 3
2
Algorithm Analysis T(n) = Running time of program on input of length n
Wall Clock CPU Clock #operations (which ones?) Length of input? #bits #items 5/21/2019 CS 303 – Big ‘Oh’ Lecture 3
3
Big O and Big Omega T(n) = O(f(n)) if there exist constants c, n0 such that T(n) <= cf(n) when n >= n0 Upper bound Worst case T(n) = W(g(n)) if there exist constants c, n0 such that T(n) >= cg(n) when n >= n0 Lower bound Average case 5/21/2019 CS 303 – Big ‘Oh’ Lecture 3
4
Big Theta T(n) = Q(h(n)) iff T(n) = (h(n)) and T(n) = W(h(n))
Tight Bounds T(n) = o(p(n)) if T(n) = O(p(n)) and T(n) <> W(p(n)) Note assymetry O – upper bound guaranteed W – lower bound “most of the time” 5/21/2019 CS 303 – Big ‘Oh’ Lecture 3
5
Growth Rates 5/21/2019 CS 303 – Big ‘Oh’ Lecture 3
6
Constant Factors Constant Factors vs. O() Question: Is 2n < 100n?
Answer: It depends on n Constant Factors come from Speed of Hardware Quality of coding Insert $ O() comes from Algorithm Complexity As memory grows and processors become faster – an O(n2) algorithm needs 4 times the processor speed to keep up with twice the memory! 5/21/2019 CS 303 – Big ‘Oh’ Lecture 3
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.