# Re: Median: Oasis and Fast Sorting Algorithm

• From: Leonard Mada <discoleo gmx net>
• To: gnumeric-list gnome org
• Subject: Re: Median: Oasis and Fast Sorting Algorithm
• Date: Sat, 10 Feb 2007 01:10:27 +0200

Well, the OASIS formula has a big problem with situations like the following: data set is: 1,1,1. So the list contains 4 values of 1. So, the median is the middle value, BUT there is really just one value repeated 3 times.
```
```
Or consider the following list: 1, 2, 2, 2, 3, 4. So the calculation of the median does take just 2 of the 3 values of 2, which is a little bit ambiguous. Which one is the middle value? Are 2 two's more middle than the 3rd two?
```
Just my thoughts.

Leonard

Andreas J. Guelzow wrote:
```
```On Sat, 2007-10-02 at 00:38 +0200, Leonard Mada wrote:

```
2. The *OASIS open formula document* puts the sorting of the array as a prerequisite to defining the median. This is misleading and should therefore be replaced with a more algorithm neutral definition. Unfortunately, the subscription to OASIS is too expensive for me, therefore I hope that other persons that do have access to the development board point this out.
```
You are clearly misreading the document. The Open Formula document does
not prescribe algorithms but only describes the return value of the
Median function. So the value ought to be the middle value (or the
average of the two middle values) if the data were sorted. No
implementaion would be required to in fact sort the data!

(...)

```
Although this definition is somehow more complex, I believe it is more accurate and more algorithm neutral.
```
How can it be _more_ "accurate"?  The OpenFormula description is 100%
accurate.

I think it is imperative that the least complex accurate definition is
used in the OpenFormula document. It is up to implementation to chose
the preferred algorithm. (The ideal algorithm may vary depending on the
type of data they typically encounter.)

Andreas

```
```

```