Question: In this problem, you will write a program that computes the median of a set of numbers ( median 1 . cc ) . The

In this problem, you will write a program that computes the median of a set of numbers (
median1.cc). The median of a list of number is computed by first sorting the list in ascending order, and choosing the number in the middle. If there is an even number of numbers, the median is the average of the two numbers in the middle.
For example, the median of the list
1,3,50,75,80
is 50, while the median of the list
1,3,50,75,80,100
is 62.5.
(a) Write the function:
void sort (int*A, int n);
which sorts the array A of n elements in ascending order. You may use any sorting algorithm you learned from CPSC 1620.
(b) Write the function:
double median (int**A, int n);
which computes the median of the array A of n elements. It is acceptable if the function rearranges the elements of A.
(c) Write the main program which asks the user to enter n, allocates an array of n elements, and displays the median. The program should repeat as long as n1. When n1, exit the program. Be sure that there is no memory leak.
 In this problem, you will write a program that computes the

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!