Binary Search is searching technique which works on Divide and Conquer approach. It used to search any element in a sorted array.
As compared to linear, binary search is much faster with Time Complexity of O(logN) whereas linear search algorithm works in O(N) time complexity.
In this article, implement of Binary Search in Javascript using both iterative and recursive ways are discussed.
Given a sorted array of numbers. The task is to search a given element X in the array using Binary search.