Question: In C++ void selectionSort(vector &arr) { for(int i = 0; i arr[j]) { swap(arr[i], arr[j]); } } } } int binarySearch(vector arr, int from, int

In C++

void selectionSort(vector &arr) { for(int i = 0; i arr[j]) { swap(arr[i], arr[j]); } } } }

int binarySearch(vector arr, int from, int to, int value) { if (from > to) return -1;

int mid = (from + to) / 2; if (arr[mid] == value) return mid; else if (arr[mid]

Implement this algorithm in C++ and test its correctness. Write a main() function to a. input a set of numbers from an input file into a vector, b. call and pass the vector to selection sort, and

c.display the sorted numbers.

Use the following input file

In C++ void selectionSort(vector &arr) { for(int i = 0; i arr[j])

D. to prompt the user for a number to search (until ^D) and display the position of the number in the sorted vector. Try your program for the following user input

{ swap(arr[i], arr[j]); } } } } int binarySearch(vector arr, int from,

The output should be:

int to, int value) { if (from > to) return -1; int

55050 215-342m

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!