Skip to content · ⁨Saltar al contenido⁩

Binary search · ⁨Búsqueda binaria⁩

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.

Español

Búsqueda binaria

El array está ordenado y tiene n elementos. Devuelve el índice de target, o -1 si no está presente. Mantén los límites lo y hi, verifica el elemento central en cada paso y descarta la mitad que no puede contener el objetivo.

Log in or create account · ⁨Iniciar sesión o crear cuenta⁩

IGCSE, A-Level & AP