#include using namespace std; bool BinSearch(char A[], int start, int stop, char element){ int mid; cout << "In Bin Search , start = "<< start << " stop = " << stop << " element = " << element << endl; if (start > stop) { return(false); } mid = (start+stop)/2; if (A[mid] == element) { return(true); } else if (A[mid] > element) { return (BinSearch(A, start,mid-1,element)); } else { return (BinSearch(A, mid+1,stop,element)); } } void search_with_comment(char c, char ary[]) { cout << " Searching for " << c; if (BinSearch(ary,0,9,c) ) { cout << " and it is present " << endl; } else { cout << " and it is NOT present " << endl; } } int main () { char ary[] = {'a','c','d','f','m','o','q','r','t','z'}; int i; search_with_comment('a',ary); search_with_comment('z',ary); search_with_comment('f',ary); search_with_comment('n',ary); }