• Post Reply Bookmark Topic Watch Topic
  • New Topic

Finding mode  RSS feed

 
Kwesi Prat
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Sheriff
Posts: 24217
38
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!