Write your question here.
Can somebody help me with this? i just cant figure it out
Here is an algorithm for selection sort which sorts n numbers in vector arr in non-decreasing order:
1 2 3 4
for (i = 0; i < n-1; i++)
for (j = i+1; j < n; j++)
if (arr[i] > arr[j])
swap(arr[i], arr[j])
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:
20
10
5
15
35
40
25
30