Question: In C++ please! Binary Search Given the code below, complete the binary search function where the data is sorted in descending order. The function will

In C++ please! Binary Search

Given the code below, complete the binary search function where the data is sorted in descending order. The function will return the vector slot where the input target is found. If the target is not found, return -1.

Examples: (assume the vector is 60, 50, 40, 30, 20, 10)

input:

50 

output:

1 

input:

15 

output:

-1

In C++ please! Binary Search Given the code below, complete the binarysearch function where the data is sorted in descending order. The function

Given the code below, complete the binary search function where the data is sorted in descending order. The function will return the vector slot where the input target is found. If the target is not found, return-1. Examples: (assume the vector is 60,50, 40, 30, 20, 10) input: 50 output: 1 input: 15 output: -1 1 #include 2 #include 3 using namespace std; 4 5 //execute a binary search algorithm against a DESCENDING orderered list and return 6 //the vector slot where target is found, if target not found then return -1 7 int BinarySearch (vector values, int target) 8 { 9} 10 11 int main() 12 { 13 vector> user Input; 17 cout

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!