# MEDIAN,(BY SORT ARRAY)

• October 12th, 2013, 06:12 AM
manahil
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...
• October 12th, 2013, 06:28 AM
GregBrannon
Re: MEDIAN,(BY SORT ARRAY)
So you're asking how to sort the array, or how to find the median without sorting the array?
• October 12th, 2013, 02:52 PM
manahil
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 :)
• October 12th, 2013, 03:07 PM
GregBrannon
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?