- Binary search requires the input data to be sorted; linear search doesn’t
- Binary search requires an ordering comparison (like
>
,<
); linear search only requires equality comparisons (=
) - Binary search has complexity
O(log n)
; linear search has complexityO(n)
- Binary search requires random access to the data; linear search only requires sequential access
- this can be very important – it means a linear search can stream data of arbitrary size