What did we just do when we determined that the running time of algorithm B grows much faster
than the running time of algorithm A.
Well first of all we said that there was some value of n.
So some value for the size of the input where this running time function
is always larger than this running time function.
So the running time of algorithm A is some function f(n) and the running time of algorithm B
is some function g(n).
So if g(n) grows faster than f(n) then there must be some value of n for which g(n) is larger than f(n).
And for any value larger than that, this must also be true and we are going to call that value n‘.
And for that value n‘, we must have that g(n‘) is larger than f(n‘)
because we're saying that g(n) grows faster than f(n)
and of course this must hold true for all values larger than n‘
So we have a second condition here that for any value larger than n‘,
we must also satisfy this condition here.
Now we also said that we do not want to care about constants.
So we do not want to care about if this here says 3n² or 5n².
We would just say that this function basically grows depending on n².
So in order to do that, we need another number in here and that number is a constant
that would allow us to scale the function g(n) and
I'm soon going to give you a few example to show what that means exactly.
But in general it means that if we can multiply this function here with some number,
let's call that constant c,
so that it outgrows f(n) then we would be still be satisfied.
Then we would still say that g(n) grows at least as fast as f(n).
And this is all you need to know to understand big O notation
because if those two conditions here are satisfied
so there are some numbers n‘ and c so that cg(n‘)≥f(n‘) so there's some point where
this function gets at least as large as this function and from any point onwards,
this function continues to be at least at large then we would say that f(n) is contained in O(g(n)).
So the big O means that g(n) is a function that grows at least as fast as f(n)
and this is the O that gives big O notation its name.
