3

I'm having an issue solving for big theta notation. I understand that big O notation denotes the worst case and upperbound while Omega notation denotes the best case and lower bound.

If I'm given an algorithm that runs in O(nlogn) time and Omega(n), how would I infer what Theta equals? I'm beginning to assume that there exists a theta notation if and only if O and Omega are equal, is this true?

sarnold
  • 102,305
  • 22
  • 181
  • 238
user1364768
  • 2,213
  • 3
  • 16
  • 8
  • Your understanding isn't correct; big-O is not the same as worst-case, Omega is not the same as best-case. – Oliver Charlesworth May 01 '12 at 22:11
  • read this too http://en.wikipedia.org/wiki/Time_complexity#Table_of_common_time_complexities and http://en.wikipedia.org/wiki/Big_O_notation#Orders_of_common_functions – Sully May 01 '12 at 22:13
  • Let me guess, you are thinking about some sort of sorting algorithm, maybe heapsort: http://en.wikipedia.org/wiki/Heapsort – bossylobster May 01 '12 at 22:14
  • if big O is not the worst case and omega is not the best case, what are they supposed to represent? – user1364768 May 01 '12 at 22:25
  • @user1364768: Upper and lower bounds, like you said. But this is distinct from best and worst case. (Consider that quicksort is O(n log n) best-case, for example.) – Oliver Charlesworth May 01 '12 at 22:28

1 Answers1

0

Assume your algorithm runs in f(x).

  • f(x) = O(n*log(n)) means that for x high enough there is some constant c1 > 0 so that f(x) will always be smaller than c1*n*log(n).
  • f(x) = Omega(n) means that for x high enough there is some constant c2 > 0 so that f(x) will be bigger than c2*n
  • So all you know now is that from a certain point onward (x big enough) your algorithm will run faster than c2*n and slower than c1*n*log(n).

  • f(x) = Theta(g(x)) means that for x big enough there is some c3 > 0 and c4 > 0 so that c3*g(x) <= f(x) <= c4*g(x), this means f(x) will only run a constant factor faster or slower than g(x). So indeed, f(x) = O(g(x)) and f(x) = Omega(g(x)).

    Conclusion: With only O and Omega given, if they are not the same you cannot conclude what Theta is. If you have the algorithm you could try and see if O was maybe chosen too high, or Omega might have been chosen too low.

  • Samuel
    • 18,286
    • 18
    • 52
    • 88