Binary Search
Learn Binary Search (Searching, Data Structures & Algorithms) with worked examples, diagrams and interview questions. Free on JavaSchoolLab.
Binary Search - O(log n) On a SORTED array, repeatedly compare the target against the middle element and discard the half that cannot contain it. Each comparison halves the search space, giving O(log n) instead of linear search's O(n).