Question: c ++ program change this so it sorts the numbers from smallest to largest order by moving the smallest to the beginning: void Sort(int array[],
c ++ program
change this so it sorts the numbers from smallest to largest order by moving the smallest to the beginning:
void Sort(int array[], int N) { int lrgIndx; int temp;
for(int last = N-1; last >= 1; last--) { lrgIndx = 0; for(int i = 1; i <= last; i++) { if(array[i] > array[lrgIndx]) lrgIndx = i; } temp = array[lrgIndx]; array[lrgIndx] = array[last]; array[last] = temp; } }
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
