The following algorithm sorts the numbers in the array from smallest to largest. The function pos_min(A,a,b) returns the
Posted: Fri May 20, 2022 2:34 pm
The following algorithm sorts the numbers in the array from smallest to largest. The function pos_min(A,a,b) returns the position of the minimum value stored between positions a and b in the array, both inclusive. How can you modify it so the sorting is now done from largest to smallest? Please, do your own modification first (even better, code it!) and then, look at the possible answers. A: array of numbers N: number of elements in array A 1 2 3 function Sort(A,N) for 0 si < N-1 min=pos_min(A, i,N-1) swap(A, A[min]) end for end function 4 5 6 O change line 3 to min=pos_min(A, 0, i) and line 4 to swap(A[min], A) none of the others change line 2 to for N-1>=;>0 change line 3 to min=pos_min(A, 0, i) O change line 2 to for N-1>=i>0 and line 3 to min=pos_min(A, 0, i)