Results 1 to 2 of 2
  1. #1
    javanubby is offline Member
    Join Date
    Mar 2012
    Rep Power

    Default 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?
    Java Code:
    public static int mode(int x[]) {
            for (int i = 1; i <= x.length - 1; i++) {
                HashSet<Integer> set = new HashSet<Integer>();
        } //end method mode
    the way I'm thinking of right now would require way too many variables and just overall makes my brain hurt thinking about it.

  2. #2
    Norm's Avatar
    Norm is online now Moderator
    Join Date
    Jun 2008
    Eastern Florida
    Rep Power

    Default Re: Getting the mode from a data set

    Can you explain what "mode" is?

    One item about your code. If you create a HashSet (line 3) it will be empty.

Similar Threads

  1. Finding Mode of an array
    By nfill14 in forum New To Java
    Replies: 0
    Last Post: 02-13-2012, 11:51 PM
  2. Debug mode
    By Aaron_Sharp in forum New To Java
    Replies: 3
    Last Post: 01-10-2011, 04:44 AM
  3. wrapped mode
    By bigj in forum NetBeans
    Replies: 1
    Last Post: 07-19-2010, 09:22 PM
  4. Replies: 1
    Last Post: 05-20-2010, 03:27 PM
  5. Replies: 0
    Last Post: 03-18-2010, 06:39 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts