0

The is the running time of an algorithm : $0.5 X^2 + 3X$ ,

Q1) i dont understand why my lecturer says that the Big O is $O(X^3)$, shouldnt it be $O(X^2)$ as it is bounded by the quadratic power of $X$.

Who is correct , me or my teacher ???

Q2) Why is the Theta of the equation : $X^2$, i cant understand why

Korvin
  • 3
  • 2
Computernerd
  • 639
  • 2
  • 11
  • 17
  • 4
    Both you and your teacher are correct (isn't that nice?). You say that it is $O(x^2)$ which is true. But anything that is $O(x^2)$ is also $O(x^3)$ since the $O(...)$ notation only fixes an upperbound. Things are different for $\Theta$ as it gives both an upperbound and a lower bound. Clearly, your running time is $\Theta(x^2)$. It cannot be $\Theta(x^3)$ as that would be too high as lower bound. – babou Mar 17 '14 at 01:37
  • 1
    -1: You asked a very very similar question recently. If you understood the answers there... – Aryabhata Mar 17 '14 at 04:00

0 Answers0