Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Please help Write a function called binarySearch that finds an occurrence of an

ID: 3678002 • Letter: P

Question

Please help

Write a function called binarySearch that finds an occurrence of an integer k in a vector v using binary search. The function declaration is given above. Write your own implementation of binary search; do not use the search function available in the C++ standard library. 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. Binary search is a natural search technique when the collection of items is stored in order. It is roughly the technique you would use to look up the meaning of a word in a dictionary or find a phone number in a telephone book. Write test code that thoroughly tests your function. DO NOT use ASSERTIONS to test.

Explanation / Answer

}

}