hi does any body now a pseudocode to calculate the following:
1) mean
2) median
3) mode
for any 10 random numbers
thanx for any help anyone is abel to provide

hi does any body now a pseudocode to calculate the following:
1) mean
2) median
3) mode
for any 10 random numbers
thanx for any help anyone is abel to provide
Put the numbers into an array.
Mean: add all of the numbers together and divide by 10.
Median: array[4] + array[5] / 2
I'm not sure of a way to calculate the mode though this might help you out:
[http://forums.devshed.com/t46666/s.html]
xhtml :: attributes . tags . <abbr> vs. <acronym> CSS :: Box Model Hack
[CF TShirts] [CP Resources] [ithium hosting] [A New Generation of Tree Menu]
Well thinking back to my primary mathematics days mode is the most frequently occurring score ( at least I hope it is ) ...
Now there are a few ways you could go around it. Depending on how many scores you have, the easiest way might be to copy the array of scores into a 2d array and use the second dimension to tally the number of scores of each and then select the one with the greatest scrore.
However the way I would do it would be to sort the scores first (asc or desc whichever your prefer) using whatever method you prefer.. I doubt you have more than say 20 scores so which sort you pick will work fine.
After that counting is easy.
[edit:]
I'm suprised antonio didn't cite you on this but 
Your title could do with a few less exclaimation marks...it's hardly going to make us want to answer your post faster if even at all..
Edit: Removed the exclamation marks from it.
/// liorean
Last edited by liorean; 05032004 at 10:42 AM.
Omnis mico antequam dominus Spookster!
Not all distributions are unimode. If these random numbers are completely randon without dumplicates, then each number will occer once and there is no mode.
If you have 2 number each apearing twice or so, then you'll have a bimodal distribution (2 modes).
So there's no straightforward answer to your question since we don't know anything about the inputvalues.
Posting guidelines I use to see if I will spend time to answer your question : http://www.catb.org/~esr/faqs/smartquestions.html
So thay first need to be split up in groups of 10 elements? (according to your original question) So then you get
9,5,6,23,25,22,12,12,2,2 as the first group, which means you'll have 2 modi : 2 and 12
so your steps are :
 sort element
 count each values occurence
 sort frequecys descending
 report value with heighest frequence.
 check if the next value has the same frequency and if so, also report it.
Posting guidelines I use to see if I will spend time to answer your question : http://www.catb.org/~esr/faqs/smartquestions.html