// Demonstration of everyday binary search. // No input. Output is result from searching for each number in -1..24 #include int a[10]={0,2,4,6,8,10,12,14,16,18}; int binSearch(int *a,int n,int key) // Input: int array a[] with n elements in ascending order. // int key to find. // Output: Returns some subscript of a where key is found. // Returns -1 if not found. // Processing: Binary search. { int low,high,mid; low=0; high=n-1; // subscripts between low and high are in search range. // size of range halves in each iteration. while (low<=high) { mid=(low+high)/2; if (a[mid]==key) return mid; // key found if (a[mid]