Skip to content · ⁨본문 바로가기⁩

Binary search

English

Binary search

The array is sorted and has n elements. Return the index of target, or -1 if it isn't present. Keep lo and hi bounds, check the middle each step, and discard the half that can't contain the target.

한국어

이진 검색

이 배열은 정렬되어 있으며 n개의 요소를 가집니다. target의 인덱스를 반환하거나, 존재하지 않으면 -1을 반환합니다. lo과 hi의 경계를 유지하고, 각 단계마다 중간값을 확인하며 타겟을 포함할 수 없는 절반을 버립니다.

Log in or create account · ⁨로그인 또는 계정 만들기⁩

IGCSE, A-Level & AP