What is a binary search algorithm?
A binary search algorithm is a search algorithm that works by dividing a sorted list into two equal parts and repeatedly comparing the middle element of each part with the target value. If the middle element is equal to the target value, the search is successful. If the middle element is greater than the target value, the search continues in the lower half of the list. If the middle element is less than the target value, the search continues in the upper half of the list. This process is repeated until the target value is found or until the search is narrowed down to an empty sub-list, indicating that the target value is not present in the original list. Binary search algorithms are very efficient for searching large, sorted lists and can quickly find the target value with only a few comparisons.
Please provide a step-by step example of such an algorithm searching for an integer in an ordered list of 100 random integers between 0 and 999. In this example, the integer we are searching for belongs to that list. Explain each step in a table.