stalin-sort icon indicating copy to clipboard operation
stalin-sort copied to clipboard

So 3, 4, 5, 6, 7, 8 and 9 are out of order in this array? [1, 2, 50, 3, 4, 5, 6, 7, 8, 9]

Open taylankasap opened this issue 4 years ago • 3 comments

Any element which is out of order is eliminated

The 50 is the asshole here, why did the others have to die? Whyyy god whyy?

taylankasap avatar Jul 12 '20 09:07 taylankasap

It's a subtle representation of how the many isms of the world and its tyrannical enforcers toy with human beings by subjecting them to arbitrary rules that ultimately result in senseless suffering.

gaburielcasado avatar Jul 13 '20 16:07 gaburielcasado

Indeed, if we have largest element at the beginning, any other elements will be removed. The approach to tackle such worst case condition is to randomly shuffle the array before using Stalin sort, which still gives O(n).

Mem2019 avatar Mar 04 '21 18:03 Mem2019

Listen lads, the 50 was obviously in that position for a good reason. If you think the Supreme Soviet might have made a mistake then by all means queue up in that line over there. Don't worry about the order.

ChrisHodges avatar Feb 08 '24 15:02 ChrisHodges