Binary Search - Recursive Implementation

This chapter details the reasoning behind binary search's time complexity

Binary search is a well-known search algorithm that works on an already-sorted input. The basic idea is to successively eliminate half of the remaining search space at each step till either the target is found or there's no more search space left.

Binary search is recursive in nature but can also be implemented iteratively. Below is the recursive implementation of binary search.

Level up your interview prep. Join Educative to access 70+ hands-on prep courses.