Alter a binary search function to find the start and end indexes of the incidences of a number k in a sorted list. — Alter this: int binary_search(item_type s[], item_type key, int low, int high) { int middle; /* index of middle element */ if (low > high) return (-1); /* key not found - replace with return low instead of -1 middle = (low+high)/2; if (s[middle] == key) return(middle); // delete if (s[middle] > key) return( binary_search(s,key,low,middle-1) ); else return(binary_search(s,key,middle+1,high) ); }
G
1.2K
Google Interview
This flashcard deck made by jwasham contains knowledge about google interview. For more details, please follow https://github.com/jwasham/google-interview-university