AlgoFrames

Searching

Find a value by scanning, or by halving a sorted range again and again.

  • Linear search Linear search checks each element from left to right until it finds the target. It works on any array and takes O(n) time.
  • Binary search Find a value in a sorted array by looking at the middle and throwing away the half that cannot contain it, until one look remains.