Question: 9. Lets sort using a method not discussed in class. Suppose you have n data values in in array A. Declare an array called Count.

9. Lets sort using a method not discussed in class. Suppose you have n data values in in array A. Declare an array called Count. Look at the value in A[i]. Count the number of items in A that are smaller than the value in A[i]. Assign that result to count[i]. Declare an output array Output. Assign Output[count[i]] = A[i]. Think about what the size of Output needs to be. Is it n or something else? Write a method to sort based on this strategy. 10. Analyze the cost of the sort you wrote in the previous problem. What is the impact of random, ordered, or reverse ordered data?

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!