Crash Course: Data Structures
Binary Search
Jun 10, 2021
Introduction
Binary Search is a type of search algorithm that returns the position of a target value within a sorted array. It does this by comparing the target value to the middle element of a sorted array.
Big-O Notation
The Big-O runtime of Binary Seach is O(log N).
Example
The algorithm searches for a target element by successively dividing a corrected array in half. In the example below, we are searching for the value of 13.