Asymptotic Analysis
2020-1νκΈ°, λνμμ βμκ³ λ¦¬μ¦β μμ μ λ£κ³ 곡λΆν λ°λ₯Ό μ 리ν κΈμ λλ€. μ§μ μ μΈμ λ νμμ λλ€ :)
λ³΄ν΅ μ°λ¦¬λ μ΄λ€ μκ³ λ¦¬μ¦μ μ±λ₯μ μ λ ₯ λ°μ΄ν°μ ν¬κΈ° $N$μ λν ν¨μλ‘ νννλ€. μ΄λ² ν¬μ€νΈμμλ μκ³ λ¦¬μ¦μ μ±λ₯μ νκΈ°νλ μ¬λ¬ κΈ°λ²λ€μ λν΄ μ΄ν΄λ³Έλ€ π
$O$ Notaiton
For two functions $f(n)$ and $g(n)$, $f(n) = O(g(n))$,
iff there exist a constant $c > 0$ and $n_0 \ge 0$ s.t. for all $n \ge n_0$,
we have $f(n) \le c\cdot g(n)$
μ¦, $g(n)$ is an asymptotic upper bound of $f(n)$.
$\Omega$ Notaiton
For two functions $f(n)$ and $g(n)$, $f(n) = \Omega(g(n))$,
iff there exist a constant $c > 0$ and $n_0 \ge 0$ s.t. for all $n \ge n_0$,
we have $f(n) \ge c\cdot g(n)$
μ¦, $g(n)$ is an asymptotic lower bound of $f(n)$.
$\Theta$ Notaiton
$f(n)$ is $\Theta(g(n))$ iff $f(n) = \Omega(g(n)) = O(g(n))$.
μ¦, $g(n)$ is an asymptotic approximation of $f(n)$.
Examples
νκΈ°λ²μ μ΅μν΄μ§κΈ° μν΄ λͺκ°μ§ λ¬Έμ λ₯Ό νμ΄λ³΄μ.
Q1. Show that for all positive integer $n$,
\[7n^5 + 1024 n^4 + 3n (\log n)^{248} + 10 = O(n^5)\]A1. λ Όλ¦¬μ λ°λΌ μ‘°κΈλ§ λμ μ΄λ©΄ κΈλ°© νλ¦Ό.
Q2. (T/F) If $f(n) = \min \{ n, 10^6 \}$, then $O(1)$.
A2. E-Z
Q3. (T/F) If $f(n) = O(n)$, then $2^{f(n)} = O(2^n)$.
A3. E-Z
Other Asymptotic Bounds
Definition. little-o notation
For every $\epsilon > 0$,
there exists a constant $n_0$ s.t. $f(n) \le \epsilon \cdot g(n)$ for $n > n_0$,
then $f(n) = o(g(n))$.
Definition. little-omega notation
if $g(n) = o(f(n))$, then $f(n) = \omega(g(n))$.
Examples
μ΄ν΄λ₯Ό λκΈ° μν΄ μ¬λ‘λ₯Ό λ¨Όμ μ΄ν΄λ³΄μ.
[Trivial case]
- $f(n) \ne o(f(n))$
-
$f(n) \ne \omega(f(n))$
- if $f(n) = o(g(n))$, then $f(n) = O(g(n))$. However, the converse is not true.
[Definition by Limitation]
If $\displaystyle\lim_{n\rightarrow\infty} \frac{f(n)}{g(n)} = 0$, then $f(n) = o(g(n))$.
Q4. (T/F) If $f(n) = 2^n$ and $g(n) = n^c$ for $c \in \mathbb{N}$, then $g(n) = o(f(n))$.
A4. E-Z. μμμ μΈκΈν κ·ΉνμΌλ‘ μ μν little-o notationμ μ°λ©΄ λ°λ‘ νλ¦°λ€.
Q5. Show that for any fixed but arbitrarily small real number $c > 0$,
\[n \log n = o(n^{1+c})\]A5. E-Z. μ΄κ²λ κ·ΉνμΌλ‘ μ μν λ²μ μ μ°λ©΄ λ°λ‘ νλ¦Ό.
Exercises
Q. (T/F) $2^n = n^{\omega(1)}$.
A. E-Z. μμ μ μ 리ν νμ, κ·ΉνμΌλ‘ μ μν λ²μ μ μ.
μ΄λ²μ μ΄ν΄λ³Έ <Asymptotic Analysis>λ μκ³ λ¦¬μ¦μ μ±λ₯μ κ°λ΅μ μΌλ‘ νλ¨νλ μ§νλ€. κ²½μ°μ λ°λΌμλ μκ³ λ¦¬μ¦μ λΆμ λ§μ Β·κ³±μ μ μμν μμ μ€μνλ€.
κ·Έλ¬λ <Asympototic Analysis>λ μ΅μ μ μν© μλμ μκ³ λ¦¬μ¦μ μ±λ₯μ νκ°νκΈ° λλ¬Έμ, μ΄κ²μ΄ μ€νλ € μκ³ λ¦¬μ¦μ μ€μ λΉμ©μ λΆνλ¦¬κ² λ§λ€κΈ°λ νλ€. μ΄λ° λ¬Έμ μ μ κ°μ ν κ²μ΄ λ°λ‘ <Amortized Analysis>μ΄λ€. κ³ κΈ μλ£κ΅¬μ‘°λ₯Ό μΈλ <Amortized Analysis>κ° μμ£Ό λ±μ₯νκΈ° λλ¬Έμ, κΌ μμμΌ νλ κΈ°λ² μ€ νλλ€.
π Amortized Analysis