250x250
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
- zipfile
- remove()
- shutil
- count()
- 오버라이딩
- __getitem__
- shuffle()
- HTML
- randrange()
- __len__
- discard()
- fnmatch
- node.js
- inplace()
- items()
- choice()
- locals()
- View
- MySQL
- decode()
- MySqlDB
- glob
- 파이썬
- __annotations__
- fileinput
- CSS
- __sub__
- Database
- mro()
- JS
Archives
- Today
- Total
목록재귀함수 (1)
흰둥이는 코드를 짤 때 짖어 (왈!왈!왈!왈!왈!왈!왈!왈!왈!왈!왈!)

1. 재귀호출(recursive call) 함수 안에서 동일한 함수를 호출하는 형태 여러 알고리즘, 고급 정렬 알고리즘 작성시 사용됨 1-1. 재귀 호출 분석 2! = 1 * 2 3! = 1 * 2 * 3 4! = 1 * 2 * 3 * 4 = 4 * 3! 1-2. 규칙 n! = n * (n-1)! 규칙을 함수로 표현해보기 함수(n)은 n>1 이면 return n*함수(n-1) 함수(n)은 n=1 이면 return n 1-3. 검증 2! 함수(2)이면 2>1 이므로 2*함수(1) 함수(1)은 1이므로 return 2*1 결과는 2 3! 함수(3)이면 3>1 이므로 3*함수(2) 함수(2)는 1번식에 의해 2!이므로 return 2*1 3*함수(2)는 3*2=3*2*1 결과는 6 4! 함수(4)이면 4>1 ..
파이썬 기초
2023. 4. 13. 08:56