Question: ( 2 5 pts ) Consider the Deviation Sorting Problem: Input: An array A = ( : a 1 , a 2 , dots, a
pts Consider the Deviation Sorting Problem:
Input: An array :dots,: of numbers.
Output: The sorted absolute deviations in nondecreasing order of the numbers from the array average.
Ex: Let :: then the array average The absolute deviation of from the array average can be calculated as
Then, the unsorted absolute deviations array can be given as ::
We obtain the output as :: after sorting the array in nondecreasing order.
a pts Design an algorithm, say Deviation Sorting algorithm, that solves Deviation Sorting Problem. Give the pseudocode of your algorithm. Hint: You may use a sorting algorithm from the lecture.
b pts Show the iterations stepbystep of your algorithm on the instance in the example.
c pts What is the computational complexity of your algorithm? Is it an efficient algorithm or not? Discuss in detail.
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
