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.

# Thread: MEDIAN,(BY SORT ARRAY)

1. ## 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. ## 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. ## 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. ## 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?