I'm writing a program where i have to output a sorted and unsorted list of numbers. I ran into a block when I had to output the Mean, Median, Mode, and the numbers Frequency (the amount of times it appears in the list)...
could someone help me out?
THank you
Well the Mean is just all then numbers added up divided by the amount of numbers. The Median is the number in the middle or the two numbers in the middle if an even amount of numbers exist and the mode is the number(s) with the highest frequency. Shouldnt be too hard once you get the sort done. Look into qsort (built in sort function) or look on the web for bubble sort. The easiest sort, but its time grows too fast when given a large amount to sort. I would think that because this sounds like a school project, you wouldnt have a very large amount of numbers and bubble sort would work fine.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.