I need to calculate the mode of 50 numbers and im struggling on how to go abouts doing this. Mathematically i have no problem but writing a program to do this is another matter.
This is what im thinking:
first of all, is there a java function that can do this????
- store the given numbers in an array
- sort the array
- compare a value in the array to the next value in the array (incrementing array[value1] and array[value2] accordingly)
- where value1 == value2 increment x (incrementing array[value1] and array[value2] accordingly)
- until end of array
- print (x+1)
I know this pseudo is very vague but i hope its enough to get my point accross.
Thanks,
nem.


LinkBack URL
About LinkBacks
Reply With Quote

