logo CodeStepByStep logo

binarySearchMC1

Language/Type: Java parameters references

Given the following sorted array of integers:

// index     0   1   2   3   4   5   6   7   8   9  10  11  12  13
int[] a = {-23, -5,  9, 14, 15, 18, 23, 24, 25, 27, 34, 62, 85, 87};

What indexes are examined in a search for each value, and what value is returned?

sequential search for 27
(order shuffled)
binary search for 27
(order shuffled)

You must log in before you can solve this problem.

Log In

Need help?

Stuck on an exercise? Contact your TA or instructor.

If something seems wrong with our site, please

Is there a problem? Contact us.