View Single Post
  #1 (permalink)  
Old 05-27-09, 12:46 PM
Hamed Hamed is offline
Wannabe Coder
 
Join Date: Jan 2007
Posts: 187
Thanks: 2
Thanked 0 Times in 0 Posts
Binary Search How to have just number argument

I know this code for binary search
Code:
int search(int a[], int key, int low, int high) {
    if (high < low) {
        return NOT_FOUND; 
    }
    int mid = (low + high) / 2;
    if (key>a[mid]) {
        return searchName(a, key,low, mid-1);
    } else if (key<a[mid]) {
        return searchName(a, key,mid+1, high);
    } else {
        return EXIT_SUCCESS; 
    }
    return ERROR_SEARCH;
}
Now I want to make recursive one which just need
int search(char *dict, char *name,int length,int compChars)
and length is number element in array.
please help me.
Reply With Quote