GeeCON Prague 2014*
The moose likes Beginning Java and the fly likes Finding mode Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Finding mode" Watch "Finding mode" New topic
Author

Finding mode

Kwesi Prat
Greenhorn

Joined: Dec 02, 2003
Posts: 7
I am trying to figure out some coding on how to find mode for an array of integers? How do I go about the coding for mode?
Thank you.
Ernest Friedman-Hill
author and iconoclast
Marshal

Joined: Jul 08, 2003
Posts: 24187
    
  34

Hi,
Welcome to JavaRanch!
If memory serves me right, the mode is the most common value, yes? Well, you loop over the array, and count the occurrences of each value.
Give it a try, come back and show us how far you get.


[Jess in Action][AskingGoodQuestions]
 
GeeCON Prague 2014
 
subject: Finding mode