Understanding big O notation

5.9k Views Asked by At

I'm not a mathematician by any stretch and I'm trying to translate some maths terms into simple maths terms. Please don't laugh, I do consider this complicated!

The equations in question are

O(n) and O(n ^ 2)

Now, I have read up on Wiki about this but it has been written (IMO) for people who already understand it!

I believe n ^ 2 translates to the power of, in this case it is also the equivalent of squaring it (i.e. n * n).

However, I can't get my head around O in terms of what it is describing. Wiki says it's the limiting behaviour. So, does this mean O is more of a description than a function or command? In my understanding, the following 2 equations are the same

O(n^2)

n^2
2

There are 2 best solutions below

2
On BEST ANSWER

Quickly, $O(n^2)$ is any function $f=f(n)$ such that $$\left| \frac{f(n)}{n^2} \right|$$ remains bounded as $n \to +\infty$. It may be $n^2$ itself, but it may also be $n$, or $\sin \cos n$, etc.

0
On

The formally correct $O$-notation has been explained in http://www.artofproblemsolving.com/Forum/viewtopic.php?f=296&t=31517&start=20 . Namely, suppose we have been given a positive $g$ defined in a punctured neighborhood of $x_0$. Now $O_{x_0}(g)$ is the class of all functions $f$ such that the ratio $f/g$ is bounded in some punctured neighbourhood of $x_0$. This definition and notation is more rigorous than for example the one given in some university's computer science courses.