Write a binary search function that works recursively, returning the index of the found item, or -1. — int binary_search_recur(int target, int numbers[], int low, int high) { if (low > high) { return -1; } int mid = (high + low) / 2; if (target > numbers[mid]) { return binary_search_recur(target, numbers, mid + 1, high); } else if (target < numbers[mid]) { return binary_search_recur(target, numbers, low, mid - 1); } else { return mid; } }
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