Skip to content

Data structures and algorithms · Searching

Binary search, the useful kind

Not "is it there?" but "where does it go?" · 10 minutes

Predict first

Plain binary search looks for 3 in [1, 3, 3, 3, 8]. Which index does it return?