Download presentation
Presentation is loading. Please wait.
Published byDerrick Harmon Modified over 9 years ago
1
1 Algorithms CSCI 235, Fall 2015 Lecture 4 Asymptotic Analysis II
2
2 Last time... Say that f is:NotationApproximately Loosely little omega gf= (g) f is way bigger than gf>g omega gf= (g) f is at least as big as gf>=g theta gf= (g) f is about the same as gf=g oh gf=O(g) f is at most as big as gf<=g little oh gf=o(g) f is way smaller than gf<g
3
3 Relationships between O,o, , , (g) (g) (g) (g) (g) is a subset of bigger f smaller f
4
4 and if f = (g) then f = (g) Why? Definition of (n): Definition of (n): If f= (g) is it necessarily true that f= (g)?
5
5 O and o if f = o(g) then f = (g) Why? Definition of (n): Definition of (n): If f= (g) is it necessarily true that f= (g)?
6
6 is a subset of and of O (g) union (g) is a subset of (g) (g) union (g) is a subset of (g) (g) (g) (g) (g) (g)
7
7 is the intersection of O and In other words: f= (g) if and only if f=O(g) and f= (g) why?
8
8 Symmetric relationships f = (g) if and only if g = o(f) why? f = (g) if and only if g = O(f) why? f = (g) if and only if g = (f) why?
9
9 Example 1 What is the relationship between f and g? What happens if you change the coefficients?
10
10 Example 2 What is the relationship between f and g?
11
11 Example 3 Can we have a function that is in O(g) but not o(g) or (g)? n if n is odd 1 if n is even Consider: a)g(n) = 1 b) g(n) = n
12
12 Helpful hints 1)Not every pair of functions is comparable 2)It may be easier to test for o(g) and (g). Try these first and then try O, and . 3)Sometimes you can deduce several relationships from the knowledge of only 1. For example: if a function is o(g) it is also O(g), but never (g), (g) or (g). 4) When in doubt, graph the functions.
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.