Introduction to Computer Science:
Quiz 12:  Binary Search
 Sewickley Academy, 2000-2001

See Course Home Page.
 
Date of Quiz: Mon Dec-18

For this quiz, starting from a blank Visual C++ project, write a program which uses the functions loadVector, sortVector, printVector, and binarySearch so that it repeatedly asks for a size of a vector (<0 to exit), creates a vector that size with random elements, sorts it, prints it, then repeatedly asks for an element to test for membership (<0 to exit the inner loop and continue with the outer loop with a new vector) and indicates whether or not the element is in the vector.

Finally, you may use the following 3 lines of code if you wish:

typedef apvector<int> intVector;
typedef intVector& intVectorByReference;
typedef int& intByReference;

Good luck!
DK


See Course Home Page.