logo CodeStepByStep logo

binarySearchMC1

Language/Type: C++ parameters references
Author: Marty Stepp (on 2016/06/16)

Given the following sorted vector of integers:

//     0   1   2   3   4   5   6   7   8    9  10  11  12  13
Vector<int> v;
v += -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

If you do not understand how to solve a problem or why your solution doesn't work, please contact your TA or instructor.
If something seems wrong with the site (errors, slow performance, incorrect problems/tests, etc.), please

Is there a problem? Contact a site administrator.

© Marty Stepp, all rights reserved.