It is a UPPER BOUND.
Example: $$ 2n = O(n)\Longleftrightarrow |2n|\leq|cn| \ 3n^2+n=O(n^2)\Longleftrightarrow |3n^2+n|\leq|cn^2| $$ Big O is a notation not a function, thus O(f(n)) is not a function.
Example:
Big O notation can be made mathematically precise by defining it to be the class of functions with complexity O(f (n)). Therefore we can say that the complexity of an algorithm is "in" O(f (n)) or, shortening it, simply say that, for an algorithm X, we have that
大 O 符号为上界其存在逻辑为 $$ \forall n \geq n_0, 0 \leq f(n) \leq cg(n) $$
-
Big O:
$f(n)=O(g(n))$ : g is an upper bound on how fast$f$ grows as$n$ increases. -
Little o:
$f(n)=o(g(n))$ : A stricter upper bound than Big O. -
Theta:
$f(n)=\Theta(g(n))$ : More precise than Big O and Little o, it provides both upper and lower bounds, which are given by the same function, except with different constant factors.
That is,$f$ and$g$ grow at the same rate. -
Asymptotically Equal:
$f(n)∼g(n)$ : stricter upper and lower bounds -
Omega:
$f(n)=\Omega (g(n))$ : an absolute lower bound (the negation of little o)
Example: $$ 2n^2=O(n^3) \ \text{and} \ 2n^2=O(n^2) $$
也就是说,我们可以找到两个正数
也就是说,其在
It is a LOWER BOUND.
- Average Case complexity
= average complexity over all possible inputs/situations
(we need to know the likelihood of each of the input!) - Worst Case complexity
= the worst complexity over all possible inputs/situations - Best Case complexity
= the best complexity over all possible inputs/situations - Amortized complexity
= average time taken over a sequence of consecutive operations
Chinese: 均摊复杂度
- "复杂度 - OI Wiki" - https://oi-wiki.org/basic/complexity/