2

Today our professor mentioned that O(n^2) is the same as Θ(n^2).

I did not understand the explanation for that and I could not find something on the internet. Can please somebody explain it to me?

Thank you very much.

templatetypedef
  • 362,284
  • 104
  • 897
  • 1,065
  • 1
    I don't think this is the right place for this question. Try programmers.stackexchange.com – Matt Grande Oct 21 '13 at 19:58
  • possible duplicate of [What is the difference between Θ(n) and O(n)?](http://stackoverflow.com/questions/471199/what-is-the-difference-between-n-and-on) – Pascal Cuoq Oct 21 '13 at 19:59
  • `f` is Big-theta(f) if it is both big-o(f) and big-omega(f) at the same thime. – loki Oct 21 '13 at 19:59

3 Answers3

1

That's not true. For example, n = O(n2) (choose c = 1, n0 = 0) but is not Θ(n2) (because limn→∞ n / n2 = 0). I suspect that you either misheard the instructor, they misspoke, or they were talking about a specific context in which it was true that didn't generalize.

Hope this helps!

templatetypedef
  • 362,284
  • 104
  • 897
  • 1,065
1

It is not the same. O is about upper bounds, Ω is about lower bounds, and Θ is about both upper and lower bounds.

As an example, a function f(n) = n is O(n^2), but not Θ(n^2), since we can't bound f from below by a multiple of n^2.

glglgl
  • 89,107
  • 13
  • 149
  • 217
Ken Wayne VanderLinde
  • 18,915
  • 3
  • 47
  • 72
0

Big O only gives an upper bound. Θ gives the lower bound as well. This SO Question should prove helpful. Your professor would be right if he said the reverse. As stated in the referenced question:

Θ(f(n)) is also O(f(n)) but not the other way around.

Community
  • 1
  • 1
Benjamin Trent
  • 7,378
  • 3
  • 31
  • 41