Question: PLEASE IMPLEMENT YOUR SOLUTION IN C++ 4) Design a recursive function similar to binary search to count the number of occurrences of a particular target
PLEASE IMPLEMENT YOUR SOLUTION IN C++

4) Design a recursive function similar to binary search to count the number of occurrences of a particular target in a sorted array of integers with duplicated items int binaryCount(const int anArrayl. const int first, const int last) The function searches the array amArray[first] through anrray[last] to count the number of appearance of a given value target by using a binary search type of algorithm. The function returns the number of occurrence, which is an integer no smaller than 0. When the target cannot be found, the function returns 0. You m ay assume the array is sorted in an a scending order of the integers. An example of such a sorted array with duplicated items is f-1, 2, 2, 5)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
