Growth of Functions

YuJangHoon·2021년 9월 11일

Algorithm(2021)

목록 보기
2/2

Asymptotic Notation

Θ\Theta-notation, OO-notation, Ω\Omega-notation 에 대해서 공부해보자

Simple Examples

  • Θ(n2)3n1\Theta(n^2) \neq 3n-1
  • O(n2)=3n1O(n^2) = 3n-1
  • Ω(n)=3n21\Omega(n) = 3n^2-1

OO-notation

  • Asymptotic Upper Bound
  • There exist Positive constants cc and n0n_0 such that
    0f(n)cg(n)0 \leq f(n) \leq cg(n) for all nn0n \geq n_0

Ω\Omega-notation

  • Asymptotic Lower Bound
  • There exist Positive constants cc and n0n_0 such that
    0cg(n)f(n)0 \leq cg(n) \leq f(n) for all nn0n \geq n_0

Θ\Theta-notation

  • Asymptotic Tight Bound
  • There exist Positive constants c1,c2c_1, c_2 and n0n_0 such that
    0c1g(n)f(n)c2g(n)0 \leq c_1g(n) \leq f(n) \leq c_2g(n) for all nn0n \geq n_0

Examples

  • Insertion sort : O(n2)O(n^2), Ω(n)\Omega(n)
    (= Best case : Θ(n2)\Theta(n^2), Worst case : Θ(n)\Theta(n))
  • Selection sort : Θ(n2)\Theta(n^2)
  • Merge sort : Θ(nlgn)\Theta(nlgn)
  • Binary search : O(lgn)O(lgn), Ω(1)\Omega(1)

Comparison of functions

  • Transitivity (=,,,<,>)(=,\leq,\geq,\lt,\gt) : aRb, bRa  aRc_aR_b,\ _bR_a \ \rightarrow \ _aR_c
  • Reflexivity (=,,)(=,\le,\ge) : aRa_aR_a is True
  • Symmetry (=)(=) : aRb  bRa_aR_b \ \rightarrow \ _bR_a
  • Transpose symmetry (  , <>)(\le \ \leftrightarrow \ \ge, \ \lt \leftrightarrow \gt) : not include '=='

Trichotomy (삼분)

  • For any two real numbers a and b, exactly one of the following must hold
    : a<b, a=b, a>ba \lt b,\ a = b,\ a \gt b,
    That is any two numbers are comparable!
  • But, any two functions does not asymptotically comparable.
    : nn and n1+sinnn^{1+sinn}
profile
HYU DataScience, ML Engineer - 산업기능요원(4급)

0개의 댓글