Question: How could you modify the selection sort algorithm to get the scores in descending order (largest score first)? ALGORITHM FOR SELECTION SORT 1. for each

How could you modify the selection sort algorithm to get the scores in descending order (largest score first)? ALGORITHM FOR SELECTION SORT 1. for each value of fill from 0 to n-2 2. Find index_of_min , the index of the smallest element in the unsorted subarray list[fill] through list[n-1] . 3. if fill is not the position of the smallest element ( index_of_min ) 4. Exchange the smallest element with the one at position fill .

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock 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 Databases Questions!