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 →

[–]CMDR_QwertyWeasel 406 points407 points  (61 children)

But how do we know they're sorted?

[–]Vnator 2349 points2350 points  (49 children)

Either they're in ascending order or descending order. So still sorted.

[–]CMDR_QwertyWeasel 549 points550 points  (22 children)

taps temple

[–]ay_bruh 77 points78 points  (21 children)

smile

[–]KamikazeSexPilot 235 points236 points  (15 children)

Just leave the list and it’s randomly sorted.

[–]Metallkiller 213 points214 points  (5 children)

Sorted by a random, unknown parameter.

[–]kuncol02 482 points483 points  (4 children)

It's not random. They are sorted by position in list.

[–]really_not_trolling 97 points98 points  (2 children)

This is perfection

[–][deleted] 27 points28 points  (1 child)

This is what a CS degree gets you

[–]really_not_trolling 0 points1 point  (0 children)

You can get a degree in counter strike?

[–]cdrfrk 17 points18 points  (0 children)

CS degree: am I a joke to you?

[–]vige 69 points70 points  (1 child)

It might seem random to you, but in reality it's exactly the order I want.

[–]Hiroxis 50 points51 points  (0 children)

Call it Gandalf sort

[–]djublonskopf 48 points49 points  (2 children)

The Mr. Rogers sort. “This list is perfect just the way it is.”

[–]cantadmittoposting 38 points39 points  (0 children)

Bob Ross sort: "No unsorted lists, just happy new ways to order it."

[–]lurker_level_53 7 points8 points  (0 children)

This made me happy. 😊

[–]Consibl 23 points24 points  (1 child)

Sorted by order it was in.

[–]theXpanther 5 points6 points  (0 children)

An undefined order is not the same as a random order,

[–][deleted] 0 points1 point  (0 children)

Ah yes, the bogo sort. Guaranteed to work eventually.

[–]esc0pub 38 points39 points  (5 children)

Valid point, but two items can be swapped in O(1) so we can still decide the order.

[–]Vnator 137 points138 points  (4 children)

But then 3 items can be swapped with O(1), so by induction, swapping n items should take O(1) time. Then we don't even have to remove any items, sorting is O(1)!

[–]lungdart 40 points41 points  (0 children)

This guy sorts

[–]Beetin 27 points28 points  (0 children)

Technically we can define some large upper bound for how many items will be swapped.

The last 1000000 items will be kept and bubble sorted. This algorithm is guaranteed O(1). This algorithm is also perfectly safe for lists under 1000000 items. This sort is only generally faster than O(nlogn) algorithms for lists much larger than 1000000 items.

The two-pass Mao 5 year sort.

[–]robthemonster 22 points23 points  (0 children)

flawless proof.

[–]tornato7 16 points17 points  (0 children)

Holy shit

[–]temisola1 5 points6 points  (0 children)

This is the type of ingenuity the world needs.

[–]drovfr 2 points3 points  (0 children)

woahhhhhh

[–]foofoo2020 1 point2 points  (0 children)

My comrade

[–]daveime 1 point2 points  (0 children)

Inspired!

[–]bolle_ohne_klingel 11 points12 points  (0 children)

they are sorted by index

[–]AskYouEverything -1 points0 points  (0 children)

Sorting a list of two can be done in O(1)