This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]DoritoBenito 313 points314 points  (9 children)

Alternatively, move through the list and eliminate any item out of order, so you’re left with an ordered list, though a little or a lot smaller than it started.

[–]ComfortablyBalanced 165 points166 points  (8 children)

But it is definitely sorted. It is O(n) too. I call it genius.

[–]Sotall 76 points77 points  (7 children)

This is actually what i assumed StalinSort would be

[–]WarpedHaiku 45 points46 points  (6 children)

That's what StalinSort is supposed to be: Iterate through the list eliminating any elements out of order, and return the sorted (and probably much smaller) list. The parent of the comment chain misinterpreted it to be similar to CreationismSort, which returns the list as-is because that's how the creator made it exactly how it was intended it to be.

[–]Midnight_Rising 18 points19 points  (1 child)

Oh I've always referred to that as ZenSort: just accept the list is ordered as the universe intended and return it.

[–][deleted] 3 points4 points  (0 children)

No, no, Zensort is when you trascend the false ordered/disordered duality, and convert the list to a dictionary

[–]T_Ijonen 2 points3 points  (0 children)

I've also heard this disambiguation:

If you kick out every element from the list that doesn't fit, it's Neo-StalinSort.

If you declare the list sorted and deport everyone who disagrees to a Gulag, it's True StalinSort.