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

1 Expert Approved Answer
Step: 1 Unlock

SortDescendingcpp include using namespa... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!