Presentation is loading. Please wait.

Presentation is loading. Please wait.

Algorithms CSCI 235, Spring 2019 Lecture 4 Asymptotic Analysis II

Similar presentations


Presentation on theme: "Algorithms CSCI 235, Spring 2019 Lecture 4 Asymptotic Analysis II"— Presentation transcript:

1 Algorithms CSCI 235, Spring 2019 Lecture 4 Asymptotic Analysis II

2 Last time... Say that f is: Notation Approximately Loosely
little omega g f=w(g) f is way bigger than g f>g omega g f=W(g) f is at least as big as g f>=g theta g f=Q(g) f is about the same as g f=g oh g f=O(g) f is at most as big as g f<=g little oh g f=o(g) f is way smaller than g f<g

3 Relationships between O,o,Q,W,w
is a subset of w(g) bigger f W(g) Q(g) smaller f O(g) o(g)

4 W and w if f = w(g) then f = W(g) Why? Definition of w(n):
If f=W(g) is it necessarily true that f=w(g)?

5 O and o if f = o(g) then f = O(g) Why? Definition of o(n):
If f=O(g) is it necessarily true that f=o(g)?

6 Q is a subset of W and of O w(g) union Q(g) is a subset of W(g)
o(g) union Q(g) is a subset of O(g) w(g) O(g) W(g) Q(g) o(g)

7 Q is the intersection of O and W
In other words: f=Q(g) if and only if f=O(g) and f= W(g) why?

8 Symmetric relationships
f = w(g) if and only if g = o(f) why? f = W(g) if and only if g = O(f) f = Q(g) if and only if g = Q(f)

9 Example 1 What is the relationship between f and g?
What happens if you change the coefficients?

10 Example 2 What is the relationship between f and g?

11 Example 3 Can we have a function that is in O(g) but not o(g) or Q(g)?
Consider: n if n is odd 1 if n is even g(n) = 1 b) g(n) = n

12 Helpful hints Not every pair of functions is comparable
It may be easier to test for o(g) and w(g). Try these first and then try O, W and Q. 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 Q(g), W(g) or w(g). 4) When in doubt, graph the functions.


Download ppt "Algorithms CSCI 235, Spring 2019 Lecture 4 Asymptotic Analysis II"

Similar presentations


Ads by Google