LIFE CODING WITH JAVA
Code Binary Search
Send Feedback
You have been given a sorted(in ascending order) integer array/list(ARR) of size N and an element X. Write a function to search this element in the given input array/list using 'Binary Search'. Return the index of the element in the input array/list. If the element is not present in the array/list, then return -1.
Sample Input 1:
7
1 3 7 9 11 12 45
3
Sample Output 1:
1
Sample Input 2:
7
1 2 3 4 5 6 7
9
Sample Output 2:
-1
I try to solve very easy concept So please watch this video .
All java code with easy trick.
By "LIFE CODING WITH JAVA". all program free no any cost So please like ,subscribe ,share and comment.
If you any doubt related to any video then comment me. As soon as I will help you .
my contact number: 6206472735