public static int BinarySearch(int[] arr, int low, int high, int key) { int mid = (low + high) / 2; if (low > high) return -1; else { if (arr[mid] == key) return mid; else if (arr[mid] > key) return BinarySearch(arr, low, mid - 1, key); else return BinarySearch(arr, mid + 1, high, key); }