CS: Asymptotic notation
Omicron or Big-O (Ο)
The Big-O sets the upper limit of a given function f(n). The set of functions Ο(g(n)) is all f(n) functions defined by:
Which basically means that, given n0
, c * g(n) it’s always greater
equals than f(n). It’s supposed to be it’s upper limit. To demostrate
that a given function is in the set of functions of Ο(g(n))
:
It will be neccessary to find any pair of values for c > 0
and n0
> 0
in order to prove that:
Demostrate that 6n + 2 ∈ Ο(n)
— example
-
Step 1: To find the right
c
constant -
Step 2: To find
n > 0
so that6n + 2 ≤ cn
-
It’s enough to find two possible values. For instance, a possible solution could be:
c = 6
it’s valid for alln ≥ 2
, therefore we can usen0 = 2
Omega (Ω)
TODO
Theta (ϴ)
TODO
Resources
-
https://www.youtube.com/watch?v=v4cd1O4zkGw[Big O Notation (HackerRank)