-
Ch1.3 Analysis of AlgorithmsComputer Engineering/알고리즘 2023. 4. 8. 20:35
Analysis of Algorithms
- 알고리즘을 분석
"Complexity" of an Algorithm
Complexity = Efficiency
The input size
- could be the size of array
- could be a single number
- For graphs, both the number of vertices and the number of edges are the input size
The basic operation
- The total work done by the algorithm is roughly proportional to the number of times Op is executed
Time Complexity Analysis
how many times the basic operation is done for each value of the input size
Best case analysis - 1
Worst case analysis - N
Average Case Analysis

1.4 Order
Complexity Function
- Any function form the non-negative integer to the non-negative real numbers



Big O


1. n^2 + 10n ∈ O(n^2) ?
Proof 1
We know that n >= 10, n^2 >= 10n
Another Proof 2
We know that n >= 1, 10n^2 >= 10n
2. 5n^2 ∈ O(n^2) ?
Proof
n >= 0, n^2 >= n^2
3. n(n+1) / 2 ∈ O(n^2) ?
Proof For n >= 0, n >= n-1
4. n ∈ O(n^2) ?
5. n^2 ∈ O(n^2 + 10n) ?
6. n^3 ∈ O(n^2) ? No
Omega O


Theta



Small O / Little O

더보기참고문헌
Richard Neapolitan, 「Foundations Of Algorithms」
Thomas H. Cormen et al., 「Introduction to Algorithms」
https://sdolnote.tistory.com/entry/BigOLittleo
Big O표기법과 little o표기법에 대한 설명
Big O표기법과 little o표기법에 대한 알아보도록 합시다. 이게 함수를 비교할 때 사용이 되는데요. 먼저, Big O 표기법은... 아래와 같습니다. 위를 'f(x)라는 함수는 g(x)의 Big O이다'라고 하죠. 개념적
sdolnote.tistory.com
⊙ 이 글은 개인 공부를 목적으로 작성된 글입니다.
⊙ 내용에 대한 오류나 피드백 감사히 받고 있습니다 !
반응형'Computer Engineering > 알고리즘' 카테고리의 다른 글
탐색 알고리즘 : 순차 Sequential / 이진 Binary / 삼분 Ternary (0) 2023.04.05 Ch 1. Algorithms : Efficiency, Analysis, and Order (0) 2023.03.02 알고리즘 Intro (0) 2023.03.02