CMIS 141
Array play 2
Modify the ArrayStuff2 program to:
Display the average ("mean") of the data and the middle value
("median") when the data is in order. Because this data is randomly
uniformly distributed, the mean and median will be almost the same.
Display the smallest and largest values in the sorted array. Sorting
gives the min and max for free.
Determine the number of different numbers in the array.
Hint: scan thru the sorted array counting each time the current element is
different than the previous element.
Report what percentage of the range of numbers was actually generated.
(Run it a few times with the range being the same as the array size,
e.g. size 100 range 100, size 1000 range 1000 etc and note the
interesting percentage. Ask a stats instructor to explain it...)
Determine the number that occurs the most times, i.e. find the number
that has the maximum number of duplicates. This is the "mode" of the
data. This is yet another "find the max" problem. It's similar to the
find the maximum length run of heads in the coin flipping program,
only easier. The array has to be sorted first.
Display a bar graph of the unsorted and sorted data.
Look at the ArrayHisto program to understand what's wanted for all these.