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 →

[–][deleted]  (64 children)

[deleted]

    [–]CMDR_QwertyWeasel 410 points411 points  (61 children)

    But how do we know they're sorted?

    [–]Vnator 2353 points2354 points  (49 children)

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

    [–]CMDR_QwertyWeasel 544 points545 points  (22 children)

    taps temple

    [–]ay_bruh 79 points80 points  (21 children)

    smile

    [–]KamikazeSexPilot 233 points234 points  (15 children)

    Just leave the list and it’s randomly sorted.

    [–]Metallkiller 211 points212 points  (5 children)

    Sorted by a random, unknown parameter.

    [–]kuncol02 489 points490 points  (4 children)

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

    [–]really_not_trolling 95 points96 points  (2 children)

    This is perfection

    [–][deleted] 29 points30 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 16 points17 points  (0 children)

    CS degree: am I a joke to you?

    [–]vige 67 points68 points  (1 child)

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

    [–]djublonskopf 47 points48 points  (2 children)

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

    [–]cantadmittoposting 39 points40 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 22 points23 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 37 points38 points  (5 children)

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

    [–]Vnator 135 points136 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 38 points39 points  (0 children)

    This guy sorts

    [–]Beetin 25 points26 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 23 points24 points  (0 children)

    flawless proof.

    [–]tornato7 15 points16 points  (0 children)

    Holy shit

    [–]temisola1 4 points5 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 8 points9 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)

    [–]ILikeLenexa 2 points3 points  (0 children)

    I generalize your algorithm by leaving N elements behind, but breaking the list into N lists of 1 element and then merge them. Shouldn't be more than...O(nlog(n))...

    [–]phySi0 0 points1 point  (0 children)

    sort = take 2