[2주차] 이진 탐색 #2
Replies: 8 comments 4 replies
-
이진 탐색1. 문제 정의대상 목록과 목푯값의 일치 여부를 확인해야 할 때 2. 선형 스캔
3. 이진 탐색 알고리즘
4. 이진 탐색 적용하기
5. 실행 시간
6. 이진 탐색이 중요한 이유
느낀점
|
Beta Was this translation helpful? Give feedback.
-
function binarySearch(arr, target){
let upper = arr.length - 1
let lower = 0
while(lower <= upper){
let mid = Math.floor((lower + upper) / 2)
if(arr[mid] === target){
return mid
}
if(arr[mid] < target){
lower = mid + 1
} else {
upper = mid - 1
}
}
return -1
} |
Beta Was this translation helpful? Give feedback.
-
이진 탐색 알고리즘을 구현하면서 읽혀지는게 신기했습니다! |
Beta Was this translation helpful? Give feedback.
-
저도 커피를 참 좋아하지만, 저자만큼 진심은 아닌 것 같아요 정리는 여기 👉 02_이진_탐색.md |
Beta Was this translation helpful? Give feedback.
-
02주차 |
Beta Was this translation helpful? Give feedback.
-
|
Beta Was this translation helpful? Give feedback.
-
이진탐색 알고리즘이 정렬되어야 작동한다는걸 까먹고있었는데 깨워줘서 고마웠습니다 |
Beta Was this translation helpful? Give feedback.
-
내용 정리선형 스캔
이진 탐색 알고리즘
생각
|
Beta Was this translation helpful? Give feedback.
-
가보자고~
Beta Was this translation helpful? Give feedback.
All reactions