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 | 31 |
Tags
- Class
- Math
- Tree
- two pointers
- SQL
- 구현
- Number Theory
- array
- Stack
- Matrix
- Data Structure
- implement
- Counting
- greedy
- Binary Tree
- java
- string
- sorting
- 파이썬
- Binary Search
- simulation
- 코딩테스트
- 코테
- bit manipulation
- Method
- hash table
- geometry
- database
- dynamic programming
- 자바
Archives
- Today
- Total
목록이진 (2)
코린이의 소소한 공부노트
Binary Search (recursive)
1. Problem - 크기가 n인 정렬된 배열 S에서 x를 찾아보자 2. Input 1) 양수 n 2) 오름차순으로 정렬된 S indexed from 1 to n 3) key x 3. Output 1) x의 위치 2) S에 x가 없다면 0 4. PseudoCode index location(index low, index high){ index mid; if(low>high) return 0; else{ mid = floor((low+high)/2); if(x==S[mid]) return mid; else if(x 13 -> 18 static int location(int low, int high, int[] S, int x) { int answer; if(low>high) answer = 0; else..
Back-End/Algorithm
2023. 2. 23. 00:32
Binary Search (iterative)
1. Problem - 정렬된 배열에서 x를 찾아보자 2. Input 1) 양수 n 2) 오름차순으로 정렬된 배열 S indexed from 1 to n 3) key x 3. Output 1) x의 위치 2) x가 없다면 0을 반환 4. PseudoCode index binsearch(int n, const keytype S[], keytype x, index location){ index low, high, mid; low = 1; high = n; location = 0; while(low
Back-End/Algorithm
2023. 2. 22. 22:38