[Nottingham] Introduction and Java Question

Peter Chang Peter.Chang at nottingham.ac.uk
Sun Oct 19 17:09:16 UTC 2008


On Sun, 19 Oct 2008, Jason Liquorish wrote:
[...]

Looking at your code more closely, there's issues with 0-indexing, upper 
bounds on your array access, whether Java arrays are zero-initialised (I 
don't know Java) and the use of frequency.length as the upper limit 
(rather than freqIndex).

The fix you made doesn't do what you mean. Think carefully about what 
you're doing.

>> Easy way to find the modal points is scan through your frequency
>> array and find the matches to "max".
> I was using the frequency array to contain a number that indicates how
> many times the number at that index occurs, then just print the index
> of medianArray to return the number that is the mode.

My point in the above is if there are a number of entries in the frequency 
array that are equal to the maximum frequency then it is easy to find and 
print out the corresponding numbers.

>> latter, you should be looking at histogram binning.
> This is totally new to me as we have not gone this in-depth/advanced
> yet. I doubt we even will as it is only a Level 3 course.

This is just basic statistics. If you're measuring some quantity that is 
described by a real number (eg, lengths of pieces of string as opposed to 
shoe size numbers) then the usual practice is to tally occurrences in 
discrete ranges (eg, 0-1cm, 1-2cm, etc) rather than look for exact matches 
as it's unlikely you will find, for example, two pieces of string 
measuring 1.23cm exactly.

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