Results 1 to 2 of 2
Thread: Getting the mode from a data set
- 03-15-2012, 10:51 PM #1
Member
- Join Date
- Mar 2012
- Posts
- 8
- Rep Power
- 0
Getting the mode from a data set
trying to make a script that makes a list of random numbers and then outputs the mean, median, and mode of the list of numbers.
I'm currently stuck at mode part... stuck at a hash table with little to no idea how to accomplish it... any helpful hints?
the way I'm thinking of right now would require way too many variables and just overall makes my brain hurt thinking about it.Java Code:public static int mode(int x[]) { for (int i = 1; i <= x.length - 1; i++) { HashSet<Integer> set = new HashSet<Integer>(); if(set.contains(x[i])) ???; else set.add(x[i]); } } //end method mode
- 03-16-2012, 12:39 AM #2
Similar Threads
-
Finding Mode of an array
By nfill14 in forum New To JavaReplies: 0Last Post: 02-13-2012, 10:51 PM -
Debug mode
By Aaron_Sharp in forum New To JavaReplies: 3Last Post: 01-10-2011, 03:44 AM -
wrapped mode
By bigj in forum NetBeansReplies: 1Last Post: 07-19-2010, 09:22 PM -
copy defaulttable mode, two different tables , with diff data
By kmm1977 in forum AWT / SwingReplies: 1Last Post: 05-20-2010, 03:27 PM -
gwt 2.0 hosted mode "plugin failed to connect to hosted mode server"
By turanan in forum New To JavaReplies: 0Last Post: 03-18-2010, 05:39 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks