1. Constant time complexity
constant time algorithm: regardless of input size, number of steps are determined.
time complexity = O(1), O(2), …
2. Linear time complexity
linear search algorithm has a time complexity of O(N)
time complexity = O(N)
N: number of inputs
linear search algorithm: time complexity = O(N)
3. Quadratic time complexity (2차 시간)
- happens when a function has nested loops(중첩 반복. ex. 중첩된 for문 등)
- time complexity = O(N^2)
4. Logarithmic Time Complexity (로그 시간)
- used to express speed of binary search
- time complexity = O(log N)
- logarithm(로그) <-> exponent(지수)
- 로그의 밑은 기재하지 않음
-
'data structure' 카테고리의 다른 글
Sort (0) | 2022.01.19 |
---|---|
Search Algorithms (Binary Search/ Linear Search) (0) | 2022.01.19 |
Array (0) | 2022.01.19 |