일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
- 글또10기x코드트리
- TS
- Filter
- map
- Next.js
- 페이지네이션
- array
- 이진탐색
- meatadata
- app.post
- 상속
- xlsx-js-style
- supabase authentication
- extends
- 슬라이딩윈도우
- supabase 페이지네이션
- 스크롤이벤트
- react
- async
- 배열중복요소제거
- set
- 타입스크립트
- 글또10기
- interface
- supabase auth
- 안드로이드빌드에러
- reactnative
- javascript
- Spring
- generic
- Today
- Total
목록이진탐색 (2)
rhanziy
이진탐색이란 ?divide and conquer(분할 정복) 패턴을 지향하는 탐색 알고리즘. 빠르고 효율적이지만 배열이 정렬되어있어야 한다.시간복잡도는 O(log n) 준비물정렬된 배열 Array A 와 Left, Middle, Right 포인터 동작원리L: 배열의 첫번째, R: 배열의 마지막, M: L 와 R의 평균값If A[M] === target return M If A[M] 미들 다음으로 탐색If A[M] > target, set R to M-1 -> 미들 이전을 최고값으로 탐색 const nums = [1,5,13,17,32,39,45,50]function binarySearch(arr: number[], target: number){ let left = 0; let rignt = arr...

재귀함수란 ? 함수 내부에서 자기자신을 호출하는 것. 재귀함수 조건Stop condition(base case)Recursive case모든 재귀함수는 스택오버플로우를 방지하기위해 실행을 종료할 base case를 정의해야한다. 재귀단계의 연산을 제대로 설정하지않으면 maximum call stack size exceeded 에러 발생function drink(x) { //1. base case if(x 예제1) 문자열을 뒤집는 함수function reverse(str){ //base case if(str == ''){ return "" } else { //recursive case return reverse(str.substr(1)) + str.charAt(0) }}resver..