Предположите, что у вас есть функция f (n)
, и вы пытаетесь классифицировать его - он большой O некоторой другой функции g (n)
.
В определении в основном говорится, что f (n)
находится в O (g (n))
, если там существует две константы C, N таким образом что
f(n) <= c * g(n) for each n > N
Теперь, давайте поймем то, что это означает.
Start with the n>N
part - it means, we do not "care" for low values of n
, we only care for high values, and if some (final number of) low values do not follow the criteria - we can silently ignore them by choosing N
bigger then them.
Взгляните на следующий пример:

Though we can see that for low values of n: n^2 < 10nlog(n)
, the second quickly catches up and after N=10
we get that for all n>10
the claim 10nlog(n) < n^2
is correct, and thus 10nlog(n)
is in O(n^2)
.
The constant c
means we can also tolerate some multiple by constant factor, and we can still accept it as desired behavior (useful for example to show that 5*n
is O(n)
, because without it we could never find N
such that for each n > N
: 5n < n
, but with the constant c
, we can use c=6 and show 5n < 6n
and get that 5n
is in O(n)
.