Question: Write a function void sort(int A[ ], int N) that uses selection sort algorithm to sort in descending order the given array A having N
Write a function void sort(int A[ ], int N) that uses selection sort algorithm to sort in descending order the given array A having N elements.To test out your function use the following main program:
int main()
{
int M[20];
int i;
for (i=0; i<20; i++) M[i]=rand()%90+10;
cout << ”Unsorted Data:” << endl;
for (i=0) i<20; i++) cout << M[i] << ” ”;
cout < sort(M,20); cout<<"Sorted Data"< for(i=0)i<20; i++) cout< cout< return 0; }
Step by Step Solution
3.58 Rating (155 Votes )
There are 3 Steps involved in it
SortDescendingcpp include using namespa... View full answer
Get step-by-step solutions from verified subject matter experts
