Skip to content · ⁨Lompat ke konten⁩

Binary search · ⁨Pencarian biner⁩

English

Binary search

The array is sorted. Return the index of target, or -1 if it isn't there. Binary search halves the range each step: check the middle element, then keep looking in just the left or right half. Far faster than scanning every element.

Bahasa Indonesia

Pencarian biner

Array ini terurut. Kembalikan indeks target, atau -1 jika tidak ada. Pencarian biner memotong rentang menjadi setengah setiap langkah: periksa elemen tengah, lalu lanjutkan pencarian hanya di separuh kiri atau kanan. Jauh lebih cepat daripada menelusuri setiap elemen.

Log in or create account · ⁨Masuk atau buat akun⁩

IGCSE, A-Level & AP