Back to course home
0% completed
Vote For New Content
9. Binary Search
Problem Statement
Write Recursive Approach to Implement Binary Search Algorithm.
The problem is to implement the binary search algorithm using recursion. Given a sorted array and a target key, the algorithm should determine whether the key is present in the array or not.
Examples
Sr # | Array | Input Key | Output |
---|---|---|---|
1 | [1, 2, 3, 4, 5] | 4 | True |
2 | [2, 4, 6, 8, 10] | 5 | False |
3 | [3, 6, 9, 12, 15] | 15 | True |
Constraints:
- 1 <= nums.length <= 10<sup>4</sup>
.....
.....
.....
Like the course? Get enrolled and start learning!
On this page