Name Paran Return Nedian o loat]: data float tint data whose size is size. If an
ID: 3590975 • Letter: N
Question
Name Paran Return Nedian o loat]: data float tint data whose size is size. If an ordered list has an odd number of elements, the median is the middle number; otherwise, it is the average of the two middle numbers. Description: returns the median of elements of VT. Name: Mean ) Parameter(s): loatj: data int: size float returns the average of elements of data whose size is size. Return: Description: VII Name: StandardDeviation() Parameter() Hoat : data Return: int: size float Description: returns the standard deviation of elements of data whose size is size. VIII Name: OutlinerCount ) Parameter(s): oarj : data int: size Return: float Description: returns the number of elements of do ta whose size is size that are o utliners. than -2 or greater than 2 An outliner is a values whose z-score is either lessExplanation / Answer
float Median(float data[], int size)
{
if(size % 2 == 1)
return data[size/2];
else
return (data[size/2] + data[size/2-1]) / 2.0;
}
float Mean(float data[], int size)
{
float avg = 0.0;
for(int i = 0; i < size; i++)
avg += data[i];
return avg / size;
}
float StandardDeviation(float data[], int size)
{
float mean = Mean(data,size);
float sum = 0;
if(size == 0)
return 0;
for(int i = 0; i < size; i++)
sum += pow((data[i]- mean), 2);
float std = sum / size;
std = sqrt(std);
return std;
}
float OutlinerCount(float data[], int size)
{
//Can you explain what do you mean by zero score.
return 0;
}
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.