LearningSolvesv1

Binary search halves a sorted search space

Each comparison rules out one side of an ordered list.

Reddit
Output
The target located or excluded in at most about ten comparisons
Input
A target value and a sorted list of 1,024 items
Relationship

What connects the input and output?

Compare the target with the middle item. Continue only in the half that can contain it, repeating until found or no items remain.

Sources

1
  1. xlinux.nist.gov: Binary search halves a sorted search spacexlinux.nist.govUS-PUBLIC-DOMAIN

Discussion

0

Sign in to join the discussion.