Notice
Recent Posts
Recent Comments
Link
| 일 | 월 | 화 | 수 | 목 | 금 | 토 |
|---|---|---|---|---|---|---|
| 1 | ||||||
| 2 | 3 | 4 | 5 | 6 | 7 | 8 |
| 9 | 10 | 11 | 12 | 13 | 14 | 15 |
| 16 | 17 | 18 | 19 | 20 | 21 | 22 |
| 23 | 24 | 25 | 26 | 27 | 28 | 29 |
| 30 |
Tags
- Oracle VM VirtualBox
- RFP
- MariaDB
- Oracle
- Algorithm
- 파이썬
- HTML
- 알고리즘
- it용어
- 오라클
- Python 라이브러리
- tibero
- 데이터베이스
- 파이썬 전처리
- dbeaver
- sql
- 파이썬 데이터프레임
- python algorithm
- Python DataFrame
- putty
- 파이썬 알고리즘
- linux
- csharp
- it 용어
- 코딩테스트
- VirtualBox
- 리눅스
- 리눅스 명령어
- PYTHON
- C#
Archives
- Today
- Total
오경석의 개발노트
Python 알고리즘_리스트 최댓값 구하기 본문
# find_max_of_list_algorithm_1, 계산복잡도 : O(n)
def max_list(n):
for i in range(len(n)):
if n[0] < n[i]:
n[0] = n[i]
return n[0]
# find_max_of_list_algorithm_2, 계산복잡도 : O(n)
def find_max(a, n):
if n == 1:
return a[0]
max_a = find_max(a, n - 1)
if max_a > a[n - 1]:
return max_a
else:
return a[n - 1]
# algorithm_2, 계산복잡도 : O(1)
max(my_list)
'알고리즘 > Python 알고리즘' 카테고리의 다른 글
| Python 알고리즘_동명이인 찾기 (0) | 2022.11.16 |
|---|---|
| Python 알고리즘_리스트 최솟값 구하기 (0) | 2022.11.14 |
| Python 알고리즘_리스트 최댓값의 위치 구하기 (0) | 2022.11.14 |
| Python 알고리즘_1부터 n까지 연속한 숫자의 제곱의 합 (0) | 2022.11.13 |
| Python 알고리즘_1부터 n까지의 합 구하기 (0) | 2022.11.09 |
Comments