Binary Search

When to use Find targetValue in sorted array Algorithm Recursive approach 1. StartIndex = 0 (lower bound), endIndex = arr.length (upper bound), midIndex = starIndex + endIndex / 2, 2. Recursion until (startIndex > endIndex (Not found)) . arr[midIndex] == targetValue ? => return midIndex .arr[midIndex] > targetValue ? => endIndex = mid – 1 (targetValue on left side) .arr[midIndex] < targetValue ?..
M_Falcon
'Binary Search' 태그의 글 목록