# computing the mean

I need to compute an arithmetic mean(average), median, and mode for up to 50 test scores. The data are contained in a text file.

To determine the median, I must first sort the array. The median is the score in the middle of the range. This can be determined by selecting the score at last/2 if last is odd. The mode is the score that occurs the most often. After building the frequency array, use it to determine which score occurred most often. (Two scores can occur the same number of times) I am working on a Unix operating system.

Â© BrainMass Inc. brainmass.com March 6, 2023, 1:07 pm ad1c9bdddfhttps://brainmass.com/computer-science/arrays/computing-the-mean-2747

#### Solution Preview

You mentioned computing the mean; I assume you're able to do that without much difficulty since you didn't mention it in the second paragraph.

<br>

<br>In order to compute the median, you mentioned having to sort. Since you didn't mention a particular method, I will describe a simple and effective sort that should do what you need.

<br>

<br>Insertion Sort is one of the simplest sorting methods, and is very intuitive. Unfortunately, it is inefficient for large lists, but for smaller lists (like the ones you will be working with), it should do the job. If you need to sort a list of numbers, one way to do it is to start by finding the smallest number in the list. ...

#### Solution Summary

Ideas for computing the mean are listed.