Binary search with Recursion
Binary search with Recursion: solved Java program for ISC Class 12 Computer Science with complete BlueJ code, explanation and sample output.
Binary search with Recursion
Binary Search
public class RecBinarySearch {
public static int recBinarySearch(int[] sortedArray, int start, int end, int key)
{
if (start <=end) {
int mid = (start+end)/2;
if (key < sortedArray[mid])
{
return recBinarySearch(sortedArray, start, mid-1, key);
} else if (key > sortedArray[mid])
{
return recBinarySearch(sortedArray, mid+1, end , key);
}
else
{
return mid;
}
}
return -1;
}
public static void main() {
int[] arr1 = {2,45,234,567,876,900,976,999};
int end=arr1.length-1;
int index = recBinarySearch(arr1,0,end,999);
if(index!=-1)
System.out.println("Element Found at "+index+" index");
else
System.out.println("Element not Found ");
}
}
Watch java videos
Related Posts
Continue learning with these related articles

Logic Gates for ISC Class 11: Truth Tables, Universal Gates, Half and Full Adder
ISC Class 11 Computer Science notes on logic gates: AND, OR, NOT, NAND, NOR, XOR and XNOR with truth tables, why NAND and NOR are universal gates, and half adder and full adder circuits with their Boolean expressions.
Decimal to Binary Conversion in Java: 3 Programs with Examples
How to convert a decimal number to binary on paper and in Java: three programs (String, place value and Integer.toBinaryString), binary to decimal, a dry run and common mistakes.

ISC Class 11 Computer Science Sample Paper 2026-27 with Solutions
A full 70-mark ISC Class 11 Computer Science sample paper for the 2026-27 annual exam: MCQs, number systems, propositional logic, logic gates, Java classes, arrays, strings, searching and sorting, and computing ethics, with complete worked solutions.