Question: Can anyone use C++ to solve this problem? Based on Problem P11.6 Implement a function bool binary.search (vector & v, int value, int & m)

Can anyone use C++ to solve this problem? Can anyone use C++ to solve this problem? Based on ProblemP11.6 Implement a function bool binary.search (vector & v, int value, int

Based on Problem P11.6 Implement a function bool binary.search (vector & v, int value, int & m) . that uses binary search to find out whether there is an integer value in the vector v of integers. If a match is found, the function returns true, otherwise it returns false. In the above function m is a reference parameter. which must be set to the location of the match if the search was successful. If value were not found, set m to the index of the next larger value instead, or to v.size() if value is larger than all the elements of the vector. Write a program that reads the list of integers from a file data3.txt and displays them on the screen. Then the program must sort the numbers using sort function from C+ library and then display the sorted vector. Finally, implement a loop in which the user is asked to enter a value, which is then searched in the sorted array using the above binary-search function. If value is found display "Found. m-" followed by the value of m. Otherwise display "Not found. m-" followed by the value of m . You can assume that data3.txt contains only integers (no floating point numbers or strings that are not numbers) and that the file has at least one number. . Submit the solution as hmw 5-3.cpp

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!