Write a procedure
that recursively sorts @v[0..m]@ in non-decreasing order using the selection sort algorithm. The rest of @v@ must not be modified.
Interface
C++ | void selection_sort(vector<double>& v, int m); |
C | void selection_sort(double v[], int m); |
Java | public static void selectionSort(double[] v, int m); |
Python | selection_sort(v, m) # returns None |
selection_sort(v: list, m: int) -> None |
Precondition
−1 ≤ @m@ < @v.size()@.
Observation
The function @position_maximum()@ of the exercise should be useful.
Observation You only need to submit the required procedure; your main program will be ignored.