Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 4 of 4

Thread: MEDIAN,(BY SORT ARRAY)

  1. #1
    Junior Member
    Join Date
    Oct 2013
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default MEDIAN,(BY SORT ARRAY)

    i have to calculate the MEDIAN of an unsorted array(i.e,array must be in sorted order before calculation of median).I am a beginner in java.kindly help me with some kinda code,and learn me how to calculate the median in this case?

    NOTE PLZ...em not asking for FULL help,actually i already had taken an input of 25 arrays and then found it's median successfully,now em facing problem in the actual LOGIC behind finding the median,at that time,when my 25 integers array is not sorted!!that's it!thnkx.
    em looking forward for YOU PEOPLE REPLY...


  2. #2
    Super Moderator
    Join Date
    Jun 2013
    Location
    So. Maryland, USA
    Posts
    5,520
    My Mood
    Mellow
    Thanks
    215
    Thanked 698 Times in 680 Posts

    Default Re: MEDIAN,(BY SORT ARRAY)

    So you're asking how to sort the array, or how to find the median without sorting the array?

  3. #3
    Junior Member
    Join Date
    Oct 2013
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: MEDIAN,(BY SORT ARRAY)

    basically i have to workout with such a code,which's gonna calculate the median,and it's must/necessary condition that,before taking median of array; that particular array must be in sorted order...then my code has to calculate the median.simple! but em confused too,like yew,as these both have different codes in the internet various sites...so em unable to understand the logic as well as different codes...as their are may sorting algorithms ....kindly guide me thanks ! i have already calculated the mean,now i have to calculate the mode and median

    --- Update ---

    give me some logic only...not codes,but some statements...so that,atleast,i can understand what i jave to done,then i will come back with my rough code..nd yew have to sort out the problem,when i will gonna ask,thankx

  4. #4
    Super Moderator
    Join Date
    Jun 2013
    Location
    So. Maryland, USA
    Posts
    5,520
    My Mood
    Mellow
    Thanks
    215
    Thanked 698 Times in 680 Posts

    Default Re: MEDIAN,(BY SORT ARRAY)

    There is an Arrays.sort() method in many forms that will do the job for you, but it's not clear if you can use that.

    If you must program your own sort method, the sorting algorithm is usually specified or you'd be expected to use one (or all) of a number of them you've discussed in class. Any clues?

Similar Threads

  1. Replies: 2
    Last Post: November 11th, 2012, 10:44 PM
  2. Iterative quick sort using median of three values
    By omfgz in forum What's Wrong With My Code?
    Replies: 1
    Last Post: September 30th, 2012, 09:59 PM
  3. Replies: 2
    Last Post: August 30th, 2012, 03:26 AM
  4. How to call a C sort function to sort a Java Array.
    By Dwere13 in forum Java Native Interface
    Replies: 22
    Last Post: July 12th, 2012, 04:44 PM
  5. can't figure out how to sort an array.
    By etidd in forum Java Theory & Questions
    Replies: 2
    Last Post: February 6th, 2010, 03:07 PM