Binary search on array of size 8 for the first element. is_number_in_array(0, {0, 1, 2, 3, 4, 5, 6, 7}, 8) is_number_in_array(0, {0, 1, 2, 3}, 4) is_number_in_array(0, {0, 1}, 2) is_number_in_array(0, {0, 1}, 1) We get an answer only when we reduce the array to size 1 (or 0). On the Mth invocation of is_number_in_array(…), it gets an array of size N / 2^(M-1). N / 2^(M-1) = 1 # that is point where we get an answer, so this M tells us how # many invocations we need to search the array. N = 2^(M-1) log₂ N = M - 1 M = log₂ N + 1