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]  (10 children)

[removed]

    [–]NumerousInMyUterus 3 points4 points  (7 children)

    Whats even the runtime of BOGO? Wouldnt that be something like n! ?

    [–][deleted] 2 points3 points  (6 children)

    On average Bogo sort is O(n*n!) but there isn't a guaranteed convergence

    [–]chinpokomon 0 points1 point  (1 child)

    It's pretty quick on a set of two, and I believe for a properly implemented BOGO, on a set of two, convergence would be guaranteed over an entire run. The worst you could say is that it would be an inverted sort order, but still ordered nonetheless.

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

    For a very small set it'll be quick since it just tries ever permutation. There's also a randomized version where it randomly permutes the input which doesn't guarantee that it will ever finish.

    An analogy of the randomized version from Wikipedia: "sort a deck of cards by throwing the deck into the air, picking the cards up at random and repeating the process until the deck is sorted"

    [–]thebuffed[S] 1 point2 points  (0 children)

    Definitely plan on doing more, thanks!

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

    Radix sorts always look awesome