100AlgorithmsChallenge icon indicating copy to clipboard operation
100AlgorithmsChallenge copied to clipboard

the challange absoluteValuesSumMinization say sorted array

Open rollrodrig opened this issue 6 years ago • 3 comments

the challange absoluteValuesSumMinization say sorted array but in the example you give an unsorted array [2, 4, 7, 6, 6, 8].

rollrodrig avatar Aug 13 '19 17:08 rollrodrig

I have the same question. The example is not a sorted array.

the example 2,4,7,6,6 results to a 6 and not a 7. Because the input is not sorted properly.

kat-ausmus avatar Sep 16 '19 22:09 kat-ausmus

Yes, instructor made a mistake here, but you can assume a sorted input like [2, 4, 6, 6, 7, 8] or sort the given input yourself because median can only be calculated on sorted numbers.

ghost avatar Jun 07 '20 07:06 ghost

Agree. It's a weird mistake and it becomes even weirder when Dylan looks at the [2, 4, 7, 6, 6] returns 7 and says the algorythm is ok.

And another note is about median. When data series length is even then usually median is calculated as sum of two central elements divided by 2.

dobromyslov avatar Sep 19 '20 07:09 dobromyslov