March 23, 2022
Algorithm that find a specific value in a sorted array. In Big O notation, the time complexity is O(log n).
A lot faster than a sequential search especially when the input is very large.
Sequential search is an algorithm that check every item from the beginning to the end of the array. Checking if it is the item we are looking for. So if we scanning through a 1 million item array, in the worst case scenario iterate through 1 million items. So the Big O notation is O(n).
The pictures below show the steps the algorithm takes to find the value.