Link to home
Start Free TrialLog in
Avatar of sepknow
sepknow

asked on

Find median from array of double with given range.

Given an array [1..1000] of double.
Given a range of say 120..820.
How do I find the median value from the given range with Delphi 6?
(Free component recommendation is acceptable).
Avatar of 8080_Diver
8080_Diver
Flag of United States of America image

This site explains the basics of the mean, median, and mode.
http://www.purplemath.com/modules/meanmode.htm
However, to answer your question more directly, the median value is the middle one, so all you need to do is find the ones that are #500 and #501 in the list when it is sorted (either in ascending or descending order).  If those are the same, then that is the median (or middle) value.  If those two are different, then the usual custom is to use the average of the two [i.e. (V500 + V501) / 2 ].
ASKER CERTIFIED SOLUTION
Avatar of 8080_Diver
8080_Diver
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial