Question: Programing in C Create a function called getMedian to determine the median value of an array. The function is provided with array x of int

Programing in C

Create a function called getMedian to determine the median value of an array. The function is provided with array x of int elements along with an int variable that contains the number of elements in the array. There are no duplicates in this array. Find median value of the array. Your function will return this value. You may also create a function to sort the array if the array needs sorted (you must decide if the array needs sorted or not). A function prototype has already been provided.

NOTE: The median of a set of numbers is the number in the set such that there are as many numbers above that value as there are below. If the set has an even number of members, the median is the average of the pair of numbers such that there are as many numbers above the pair as there are below.

EXAMPLE 1: Given 5 8 1 9 7 the median is 7 because there are two numbers below (1 5) and two numbers above (8 9).

EXAMPLE 2: Given 3 7 1 4 6 9 the median is the average of 4 and 6 because there are two numbers above 4 and 6 (7 9) and two numbers below (3 1).

this is what i have so far...

#include

int getMedian(int array[], int size);

int main(void){ int a[] = {1422731264, 1559063602, 223477957, 1623079617, 1631867268, 1334202695, 635417433}; int medianValue = -1; medianValue = getMedian(a, 7); printf("The median value is %d", medianValue); }

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!