© 2014 Firstsoft Technologies (P) Limited. login
Hi 'Guest'
Home SiteMap Contact Us Disclaimer
enggedu
Quick Links
Easy Studies


C Program To Implement Binary Search :

#include #include void main() { int a[25],i,j,temp,s,n,low,mid,high; clrscr(); printf("\nEnter the Limilt : "); scanf("%d",&n); printf("\n\nEnter the elements\n"); for(i=0;ia[j+1]) { temp=a[j]; a[j]=a[j+1]; a[j+1]=temp; } } } printf("\n\nSorted list"); for(i=0;ia[mid]) low=mid+1; else if(s

SAMPLE INPUT AND OUTPUT:

 Enter the elements
5
4
3
2
1

Sorted list
1
2
3
4
5

Enter the element to be searched : 5

The element 5 is found.

 
SLogix Student Projects

⇓Student Projects⇓
⇑Student Projects⇑
bottom