Question: Problem 7 : [ 8 points ] Improved Selection Sort The Selection Sort algorithm can be optimized by tracking both the minimum and maximum elements
Problem : points
Improved Selection Sort
The Selection Sort algorithm can be optimized by tracking both the minimum and maximum elements in a single pass. This allows you to sort two elements with each iteration, effectively reducing the number of passes needed through the array. The number of swaps can also be reduced by performing a swap only at the end of each outer loop iteration and if it is needed.
a points Implement the improved Selection Sort algorithm on a randomly generated list of integers. Measure the sorting time using and submit your code.
b points Measure and record the sorting time for the following input sizes for the selection sort and the improved selection sort algorithms. Take the average of at least measurements for each value of
tableRandom order,,,,,,,,Increasing order,,,,,,,,Decreasing order,,,,,,,,
c points Plot a graph of the data you collected in part b for the two algorithms and discuss the results.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
