Question

bool contains(const vector<int>& v, int k);

Write a function called contains that
finds an occurrence of an integer k in a vector v using binary
search. The function signature is given above. Write your own
implementation of binary search; do not use the binary search
function available in the C++ standard library through the
algorithms header.

Binary search assumes that the sequence of values (stored in a
vector in our case) is either non-decreasing or non-increasing.
Assume that the vector passed into binarySearch is non-decreasing,
which means that each value beyond the first is either equal to or
greater than the previous value.