true
. Otherwise, return false
.binarySearch({2,5,7,8,9},9) -> true
binarySearch({2,8,9,12},6) -> false
binarySearch({2},4) -> false
binarySearch({},9) -> false
{} -> [Empty] Array
start
, end
and mid
indices to keep a track of the two subarrays formed by splitting the given array at the middlepublic static Boolean binarySearch(int[] arr, int n){ }
C
Java
Python