Data Structures Lab Manual / Binary Search C Program in Data Structures

Program Name: Write a C Program for Binary Seach in Data Structures
Theory
Binary Search first Sort the elements of the array in Ascending order and try to search the key element based
on the mid value = (beg+end)/2; 
Program Code



Input:
Enter Number of Elements: 5
Enter Elements in Ascending Order: 1 3 5 7 9
Enter Search Element: 5
Output:
Element found at =3


Home     Back