70 likes | 99 Views
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 E-mail: droberts@cs.iupui.edu. Big-Omega and Big-Theta Defined.
E N D
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 E-mail: droberts@cs.iupui.edu
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+ n2and g(n) = n3
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.
Big-Theta Asymptotic Tight Bound • Theta means that f is bounded above and below by g; BigTheta 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.
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.
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.
Acknowledgements • Philadephia University, Jordan • Nilagupta, Pradondet