jqdjhy.log
로그인
jqdjhy.log
로그인
Growth of Functions
YuJangHoon
·
2021년 9월 11일
팔로우
0
algorithm
Algorithm(2021)
목록 보기
2/2
Asymptotic Notation
Θ
\Theta
Θ
-notation,
O
O
O
-notation,
Ω
\Omega
Ω
-notation 에 대해서 공부해보자
Simple Examples
Θ
(
n
2
)
≠
3
n
−
1
\Theta(n^2) \neq 3n-1
Θ
(
n
2
)
=
3
n
−
1
O
(
n
2
)
=
3
n
−
1
O(n^2) = 3n-1
O
(
n
2
)
=
3
n
−
1
Ω
(
n
)
=
3
n
2
−
1
\Omega(n) = 3n^2-1
Ω
(
n
)
=
3
n
2
−
1
O
O
O
-notation
Asymptotic
Upper
Bound
There exist Positive constants
c
c
c
and
n
0
n_0
n
0
such that
0
≤
f
(
n
)
≤
c
g
(
n
)
0 \leq f(n) \leq cg(n)
0
≤
f
(
n
)
≤
c
g
(
n
)
for all
n
≥
n
0
n \geq n_0
n
≥
n
0
Ω
\Omega
Ω
-notation
Asymptotic
Lower
Bound
There exist Positive constants
c
c
c
and
n
0
n_0
n
0
such that
0
≤
c
g
(
n
)
≤
f
(
n
)
0 \leq cg(n) \leq f(n)
0
≤
c
g
(
n
)
≤
f
(
n
)
for all
n
≥
n
0
n \geq n_0
n
≥
n
0
Θ
\Theta
Θ
-notation
Asymptotic
Tight
Bound
There exist Positive constants
c
1
,
c
2
c_1, c_2
c
1
,
c
2
and
n
0
n_0
n
0
such that
0
≤
c
1
g
(
n
)
≤
f
(
n
)
≤
c
2
g
(
n
)
0 \leq c_1g(n) \leq f(n) \leq c_2g(n)
0
≤
c
1
g
(
n
)
≤
f
(
n
)
≤
c
2
g
(
n
)
for all
n
≥
n
0
n \geq n_0
n
≥
n
0
Examples
Insertion sort :
O
(
n
2
)
O(n^2)
O
(
n
2
)
,
Ω
(
n
)
\Omega(n)
Ω
(
n
)
(= Best case :
Θ
(
n
2
)
\Theta(n^2)
Θ
(
n
2
)
, Worst case :
Θ
(
n
)
\Theta(n)
Θ
(
n
)
)
Selection sort :
Θ
(
n
2
)
\Theta(n^2)
Θ
(
n
2
)
Merge sort :
Θ
(
n
l
g
n
)
\Theta(nlgn)
Θ
(
n
l
g
n
)
Binary search :
O
(
l
g
n
)
O(lgn)
O
(
l
g
n
)
,
Ω
(
1
)
\Omega(1)
Ω
(
1
)
Comparison of functions
Transitivity
(
=
,
≤
,
≥
,
<
,
>
)
(=,\leq,\geq,\lt,\gt)
(
=
,
≤
,
≥
,
<
,
>
)
:
a
R
b
,
b
R
a
→
a
R
c
_aR_b,\ _bR_a \ \rightarrow \ _aR_c
a
R
b
,
b
R
a
→
a
R
c
Reflexivity
(
=
,
≤
,
≥
)
(=,\le,\ge)
(
=
,
≤
,
≥
)
:
a
R
a
_aR_a
a
R
a
is True
Symmetry
(
=
)
(=)
(
=
)
:
a
R
b
→
b
R
a
_aR_b \ \rightarrow \ _bR_a
a
R
b
→
b
R
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
>
b
a \lt b,\ a = b,\ a \gt b
a
<
b
,
a
=
b
,
a
>
b
,
That is
any two numbers are comparable!
But, any two functions does not asymptotically comparable.
:
n
n
n
and
n
1
+
s
i
n
n
n^{1+sinn}
n
1
+
s
i
n
n
YuJangHoon
HYU DataScience, ML Engineer - 산업기능요원(4급)
팔로우
이전 포스트
Insertion sort, Merge sort
0개의 댓글
댓글 작성