Re: any relation between median and mean?
From: Gordon Sande (g.sande_at_worldnet.att.net)
Date: 06/12/04
- Next message: Fletch F. Fletch: "Re: Pi Shop"
- Previous message: pp: "How to fit data set of different scales with nonlinear least square!"
- In reply to: Brian Hetrick: "Re: any relation between median and mean?"
- Next in thread: spasmous: "Re: any relation between median and mean?"
- Messages sorted by: [ date ] [ thread ]
Date: Sat, 12 Jun 2004 15:28:43 -0300
On Fri, 11 Jun 2004 22:09:32 -0300, Brian Hetrick wrote
(in article <oY2dnR1POKpNylfdRVn-vg@comcast.com>):
> "bv" <bvoh@Xsdynamix.com> wrote ...
>> Sort the array and the median, curiously, will be in the middle of
>> the set.
>
> Truly. But there is in fact no need to sort the array: you need only
> identify the middle element.
>
> A variation on the quicksort algorithm should work. Pick a guess at the
> median, and advance in from either end of the array swapping elements when
> they are in the wrong halves. The middle element will either be where the
> two indices point, or in one of the halves. If the latter, do it again on
> the half having the median. Rinse and repeat.
>
> A full sort would be O(n log n). The algorithm sketched above would be O(n).
>
You have given a know effective algorithm but its worst case performance
is not guaranteed. There are know algorithms with guarantee worst case
performance that are also linear. Basic scheme to to lay data out in a
two way array, sort the columns and then find median of the column
medians and remove all elements _known_ to be below or above the
trial value (from the structure of the array) to get a smaller problem.
Repeat and get various details correct.
>
- Next message: Fletch F. Fletch: "Re: Pi Shop"
- Previous message: pp: "How to fit data set of different scales with nonlinear least square!"
- In reply to: Brian Hetrick: "Re: any relation between median and mean?"
- Next in thread: spasmous: "Re: any relation between median and mean?"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|