Download presentation
Presentation is loading. Please wait.
Published by芙燥 凌 Modified over 5 years ago
1
An Upper Bound g(n) is an upper bound on f(n). C++ Review EECE 352
2
A Lower Bound g(n) is a lower bound for f(n) C++ Review EECE 352
3
A Tight Bound We say that g(n) is an asymptotically tight bound for f(n). C++ Review EECE 352
4
Transitivity The operators are transitive. They are also Reflexive.
and imply and imply imply and The operators are transitive. They are also Reflexive. C++ Review EECE 352
5
Exercises Show that for any constants a and b >0. Is 2n+1 = O(2n) ?
Rewrite in Big-O notation: C++ Review EECE 352
6
Rules to Remember If T1(n) = O(f(n)) and T2(n)=O(g(n)) then
T1(n) + T2(n) = max(O(f(n)), O(g(n))) T1(n)*T2(n) = O(f(n)*g(n)) If T(n) is a polynomial of degree n, then T(x) = (xn). logkn = O(n) for any constant k. C++ Review EECE 352
7
Sample Functions C++ Review EECE 352
8
Analyzing Algorithms Model of idealized computer:
The usual set of operators, all take constant time. No fancy operators. Infinite memory. Find the amount of time it takes to finish as a function of the input size. C++ Review EECE 352
9
Loops A loop of size n that does something that takes time k will take nk total time. This applies recursively. If the something is also a loop of size n it will take n2k. And so on... Recursion Could be just a for loop, could be worse. C++ Review EECE 352
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.