Skip to content

Searching: linear and binary

Handout

Finding a value

  • A common job is to search: is a value in an array, and where?
  • The usual answer is the index where we found it, or -1 if it is not there.
  • We learn two ways: linear search (works on any array) and binary search (needs a sorted array, but is much faster).

Handout

Log in or create account

IGCSE & A-Level