[Nottingham] Introduction and Java Question
Peter Chang
Peter.Chang at nottingham.ac.uk
Sun Oct 19 11:59:32 UTC 2008
On Sun, 19 Oct 2008, Jason Liquorish wrote:
> I have had a breakthrough and I can now find the most recurring number
> in the array, my only problem now is if two or more numbers occur the
> same amount of times I am not sure how to print them all out.
>
> My code is here http://dpaste.com/85429/
There's an error in your code. You store the max frequency but not the
index. Then you use "max" as an index (line 84).
Easy way to find the modal points is scan through your frequency array and
find the matches to "max".
My main concern with your code is that you haven't specified whether the
input numbers are integers or floating point numbers. If it's the latter,
you should be looking at histogram binning.
hth
Peter
This message has been checked for viruses but the contents of an attachment
may still contain software viruses, which could damage your computer system:
you are advised to perform your own checks. Email communications with the
University of Nottingham may be monitored as permitted by UK legislation.
More information about the Nottingham
mailing list