Binary Search

Fill in the blanks

is a popular algorithm used to efficiently search for a in a . It follows the strategy, where the array is repeatedly divided in half until the target element is found. The occurs by continuously narrowing down the search space based on a and of the mid-point element with the target element.

The main advantage of binary search lies in its significant reduction of the search space with each iteration. This allows for a fast search process, resulting in a logarithmic of O(log n), where n represents the size of the array. The of binary search is relatively low with O(1), as it only requires a small amount of additional space to store the mid-point index and the comparison result.

Keywords

comparison | time complexity | divide and conquer | iteration | index | sorted array | mid-point | binary search | target element | space complexity |