Explanations, pseudocode, an embedded interactive visualization, implementations in JavaScript, Python, Java and Go, complexity and interview variations.
Checks every element from left to right until the target is found or the array ends. Works on unsorted data.
Searches a sorted array by repeatedly comparing the target with the middle element and discarding the half that cannot contain it.
First index whose value is ≥ target in a sorted array (binary-search variant).
First index whose value is > target in a sorted array.
Binary search that first decides which half is still sorted.