Binary Search Algorithm
No, you don’t need to know binary code for this.
The binary search algorithm is a very popular and well-known algorithm for finding a specific value within a sorted array. It is also a popular algorithm to teach computer science studies and it isn’t too hard to grasp the basic principles of it.
The algorithm works on sorted arrays where it begins comparing the centermost value against the target value. If the target value is smaller than the centermost element the search continues in the lower half of the array where it will again compare the center value to the target.
This means that every time the target value isn't found, the size of the searchable array halves until two values are left.
In the image, you can see that the value is found after four iterations. Each iteration halves the searchable range which gives this algorithm a worst-case performance of O(log N).
That is the binary search algorithm, thank you for reading and have a wonderful day.