<aside> 💡 Find the elements of a ORDERED collection in O(log n)
</aside>
In a collection of elements you want to find an specific one. So, the common way of doing it is just look one-by-one and top and you do it. But, for ordered collections, there is a better and way more efficient approach: cut in your search environment in half in every step.
<aside> 💡 Notice that it MUST be ordered so it pretty much only works with lists and arrays
</aside>
Consider a sorted collection: 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, and suppose you are searching for the number 7.
The binary search algorithm efficiently eliminates half of the remaining elements at each step, making it a logarithmic time complexity algorithm. This method is particularly advantageous for large datasets, providing a swift and systematic approach to locate a specific element.