Binary search is a simple yet efficient searching algorithm which is used to search a particular element's position in a given sorted array/vector.
In this algorithm the targeted element is compared with middle element. If both elements are equal then position of middle element is returned and hence targeted element is found.
If both elements are unequal then if targeted element is less or more than middle element we discard the lower or upper half and the search continues by finding new middle...
Published on May 31, 2020 10:35