1. Write the following functions given their respectivespecifications: void sort
ID: 3613780 • Letter: 1
Question
1. Write the following functions given their respectivespecifications:
void sort (int A[], int nElem) - This function should sortthe n elements of A in
ascending order.
float median (int A[], int nElem) – this function shouldreturn the middle element of array
A with nelements. If there are two middle elements, the functionshall return the average of these two middle values. Notehowever that you first have to sort the array before getting themiddle element(s).
int frequency (int A[], int nElem, int nValue) – Thisfunction should return the number of
times the value, nValue is found in the array.
int mode(int A[], in nElem) – This function should returnthe elements(s) of A having the
highest frequency.
Explanation / Answer
please rate - thanks for mode I used your other assignment, but since all same elementsare next to each other it could have been done differentlt #include #include void sort (int[],int); float median (int A[], int nElem); int frequency (int A[], int nElem, int nValue); int mode(int A[], int nElem); int main() {int A[14]={1,2,3,4,4,2,2,1,2,4,1,4,4,4},nElem=14,i,m; float fm; printf("The array: "); for(i=0;iRelated Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.