Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

SortDescendingcpp include using namespa... blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Numerical Analysis

Authors: Richard L. Burden, J. Douglas Faires

9th edition

538733519, 978-1133169338, 1133169333, 978-0538733519

More Books

Students also viewed these Programming questions

Question

=+2 Identify the treatment and response.

Answered: 1 week ago

Question

Do the calculations to determine the missing amounts in the table.

Answered: 1 week ago