Presentation is loading. Please wait.

Presentation is loading. Please wait.

Analysis of Algorithms Big-Omega and Big-Theta

Similar presentations


Presentation on theme: "Analysis of Algorithms Big-Omega and Big-Theta"— Presentation transcript:

1 Analysis of Algorithms Big-Omega and Big-Theta
Department of Computer and Information Science, School of Science, IUPUI CSCI 240 Analysis of Algorithms Big-Omega and Big-Theta Dale Roberts, Lecturer Computer Science, IUPUI

2 Big-Omega and Big-Theta Defined
If f = W(g), then f is at least as big as g (or g is a lower bound for f) e.g. f(n) = n3 and g(n) = n2 If f = (g), f=O(g) and f = W (g) (or g is both an upper and lower bound. It is a “tight” fit) e.g. f(n) = n3 + n2 and g(n) = n3

3 Big-Omega Example Example: n 1/2 = W( lg n) .
Use the definition with c = 1 and n0 = 16. Checks OK. Let n > 16: n 1/2 > (1) lg n if and only if n > ( lg n )2 by squaring both sides. This is an example of polynomial vs. log. n (log n)^2 Diff 16 17 16.71 0.29 18 17.39 0.61 19 18.04 0.96 20 18.68 1.32 21 19.29 1.71 22 19.89 2.11 23 20.46 2.54 24 21.02 2.98

4 Big-Theta Asymptotic Tight Bound
Theta means that f is bounded above and below by g; Big Theta implies the "best fit". f(n) does not have to be linear itself in order to be of linear growth; it just has to be between two linear functions. We will use Theta whenever we have enough information to show that the f(n) is both an upper and lower bound. Theta is a “stronger” statement than Big-Oh or Big-Omega.

5 Big-Theta Example Example: f(n) = n2 - 5n + 13.
The constant 13 doesn't change as n grows, so it is not crucial. The low order term, -5n, doesn't have much effect on f compared to the quadratic term, n2. Q: What does it mean to say f(n) = Q(g(n)) ? A: Intuitively, it means that function f is the same order of magnitude as g.

6 Big-Theta Example (cont.)
Q: What does it mean to say f1(n) = Q(1)? A: f1(n) = Q(1) means after a few n, f1 is bounded above & below by a constant. Q: What does it mean to say f2(n) = Q(n lg n)? A: f2(n) = Q(n lg n) means that after a few n, f2 is bounded above and below by a constant times nlg n. In other words, f2 is the same order of magnitude as nlg n. More generally, f(n) = Q(g(n)) means that f(n) is a member of Q(g(n)) where Q(g(n)) is a set of functions of the same order of magnitude.

7 Acknowledgements Philadephia University, Jordan Nilagupta, Pradondet


Download ppt "Analysis of Algorithms Big-Omega and Big-Theta"

Similar presentations


Ads by Google