Assume that inputList is an ArrayList of Integer objects that contains the following values. [0, 10, 30, 40, 50, 70, 70, 70, 70] What value will be returned by the call binarySearch(inputList, 0, 8, 70)

Respuesta :

Based on the inputList and the binarySearch, the value that will be returned by the call binarySearch above is 6.

What value will be returned?

With inputList =  [0, 10, 30, 40, 50, 70, 70, 70, 70], the first call would be:

1st call = binarySearch(inputList, 0, 8, 70)

mid = 8 + (0/2)

= 4

if (70 is less then 50)

A second call would yield:

2nd call = binarySearch(inputList, 5, 8, 70)

mid = 13/2

= 6

if (70 = (70))

Return is 6 is the above holds so output is 6.

Find out more on Binary searches at https://brainly.com/question/21475482.