Sorting

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.

© SolutionLibrary Inc. solutionlibary.com 9836dcf9d7 https://solutionlibrary.com/computer-science/data/sorting-2lr

Solution Preview

...ou check all of the numbers in your list, find the smallest, and put it at the start of the list. Now you have a sorted list of one number! It may not sound amazing yet, but you can take the same approach for the second number by the following: do the same thing you did before (find the smallest number) for the remaining list. If you ignore the first number you found and only search the rest of the list, you are in essence looking for the second smallest number. Once you find that, put it in the second spot in the list. Do this for all elements, and when you finish, you will have a sorted list.
<br>
<br>Unfortunately, you didn't mention what language you'll be ...