Talk:Bogosort

message: The additional algorithms here are written up cleverly and interestingly, and are of at least passing interest to computer scientists, but do these really belong on the Bogosort page?  We already have a "computer humor" category from which Bogosort is linked; how about a new entry for "Frivolous sorting algorithms", and move all the content from here into that entry?  Bogosort could redirect. Johnwbyrd (talk) 20:25, 14 September 2016 (UTC)
thread_title:  Let's move this article into a new article called Frivolous sorting algorithms 

message: Is it really O(Infinity)? That seems to imply that in the worst case it will never be sorted; but if it is run indefinitely it must eventually be so... 173.57.168.166 (talk) 06:01, 1 November 2010 (UTC)
replies: text: Well... from what I know, yes it is really O(∞). In this case, "Worst case" means taking the least effective action each time. At least, that's how I interprate it. Although you are correct in that realistically, it will eventually get sorted. 173.24.183.93 (talk) 03:17, 17 November 2010 (UTC)
replies: text: The only actions taken are shuffling the list, and checking if it is in the correct order. There is no guarantee that a single random shuffle will result in the correct order, and each shuffle is independent of the previous one, so in the worst case the correct order would never be achieved. --Joshua Issac (talk) 08:36, 18 May 2011 (UTC)
replies: text: Yes, there is a guarantee. The probability that the algorithm will terminate is 1. The expected runtime is less then (n+1)!. The algorithm is thus positive almost sure terminating (sometimes also called bounded almost sure termination). Thats second strongest criterium for probabilistic algorithms there is for termination (only followed by certain termination). You may have a misconception of 'worst case' runtime. Worst case only references to the input of your algorithm. Phrased differently: What is the runtime of the algorithm for the worst input you can find? The random bits however are not part of the input. They are separate objects. I don't know any source that handles random bits as part of the input. If you have any source that implies otherwise, I would be grateful for this. PhoenixIra (talk) 08:26, 29 May 2020 (UTC)
thread_title:  Worst-case complexity 

message: I don't think "For dealing with a list of two elements, this places Bogosort amongst the best sorting methods: one comparison, and then either it finishes, or else there is one swap and one more comparison" is right.  Even for a two-element list, the number of iterations (and thus running time) is unbounded; for any given n it is possible for the sort to last more than n iterations.
Maybe I don't know what it's trying to say.  Superm401 - Talk 09:55, 22 May 2009 (UTC)
replies: text: You are correct.  This analysis depends on the shuffle explicitly excluding the identity permutation, which is typically not the case with the bogosort.  The Gruber, et al. reference does analyze two forms of the bozo-sort, one of which (referred to in the paper as bozo-sort+) does explicitly exclude the null swap, but nowhere does that reference discuss the two element list case.  I have removed this unsourced and arguably incorrect analysis.  -- Thinking of England (talk) 03:58, 25 July 2009 (UTC)
thread_title:  Two-element list

message: The article currently states that the sort "is named after the humorous term quantum bogodynamics and, ultimately, the word bogus."  I can't find any reference for this; it seem more likely that both "bogosort" and "quantum bogodynamics" derive directly from "bogus".  The "quantum bogodynamics" connection was first added in this unsourced edit. -- Thinking of England (talk) 19:56, 24 July 2009 (UTC)
thread_title:  Questionable etymology 

message: Only 2number of random bits.
--Dc987 (talk) 08:55, 21 November 2009 (UTC)
thread_title:  "the quantum randomization spawns an infinite array of universes" 

message: The best case sorts in one step, shouldn't that be denoted as O(0)? AttishOculus (talk) 06:55, 7 December 2010 (UTC)
replies: text: No, even if the list is already sorted, you need to walk it to know you're done. Testing if an n-elements list is sorted requires at least n-1 comparisons. Thus an O(n) best case complexity. This is actually a limit for any sorting algorithm. -- 86.71.9.237 (talk) 05:45, 5 January 2011 (UTC)
thread_title:  Best case complexity 

message: http://robsort.org/ - multithreaded, so massive parallelization would make it somewhat more efficient than Bogosort.  — Preceding unsigned comment added by 207.171.191.61 (talk) 21:27, 14 February 2012 (UTC)
thread_title:  Other implementations 

message: Why was this removed? I think this more clearly explains how Quantum BogoSort is supposed to work:
" The list is then tested for sortedness (requiring n-1 comparisons); should it be out of order, the computer destroys the universe — implementation of this step being left as an exercise for the reader. The only observers will then be in the surviving universes and will see that the randomization worked the first time and that the list is in sorted order."  — Preceding unsigned comment added by 199.46.198.232 (talk) 18:49, 24 April 2012 (UTC)
thread_title:  Quantum BogoSort explanation 

message: The shuffle method is important, because any code written is likely to employ pseudo random numbers.  For any list, the bogosort algorithm will either eventually sort the list, or otherwise eventually find itself with the list in the same order as when it started AND independently happen to have the pseudo random generator seeded to the same value - after which the exact same set of operations would occur over and over again, with zero chance of success.
I quote from the piece 'For any collection of fixed size, the expected running time of the algorithm is finite for much the same reason that the infinite monkey theorem holds' - Actually that can only be true if you have true random numbers for swapping, or at least a sequence of pseudorandom numbers that is not repeating.  
The infinite monkey theorem itself might not be true (as assumed here to tend to a prob of 1 as N tends to infinity) - for any monkey there may be some reason why the sequence of key presses for success is not possible, although it's hard to see why that might be, but it's also hard to disprove via experiment.
Back to the bogosort, Let's say I've got a sequence of 10^10 pseudo random numbers, but I'm sorting a list of 50 with 2x10^64 possible orders - the chance that I can get to the 1 sorted order before I encounter one of the unsorted orders more than once, and with the pseudo random seed in the same position, is looking slim - because when I reach the sorted state, probability says I've visited a vast number of other states 2 or more times. 
Gomez2002 (talk) 16:30, 14 April 2015 (UTC)
thread_title:  How does the Shuffle Algorithm Work 

message: To be clear, I am no longer involved with the discussion on ʘx's talk page.
The issue of which I am aware is that we do not have a source to support the choice of any specific formal system in which to define quantum bogosort and relate it to the underlying concept of a sorting algorithm. Until that is resolved, according to ʘx, it is meaningless to make any statement about quantum bogosort other than that it consists informally of a certain sequence of informal steps or that it is formally ill-defined.
As NickyMcLean seems to have a general interest in computing but no clear experience with this particular topic, I felt it was proper to apologize for dragging him/her into our overly verbose discussion. My post on his/her talk page contains a slightly longer summary of my actions within the discussion. --SoledadKabocha (talk) 03:27, 17 November 2015 (UTC)
replies: text: Provoked by all the talk, I tracked down some specific references employing the "destroy universe" computational trick: Doomsday Device by John Gribben (Analog Science Fiction/Science Fact, February 1985), and Games, Puzzles and Computation by R.A. Heam and E.D. Demaine (2009), page 103-4, for example. Considering that W. has a rule "Ignore all rules" (including this one) with a view to inclusivity, I don't see any real need to be so picky over an approximate description in the absence of a formal one. Nor is there an agreed formal system to express it within. Readers of the (currently removed) text could well discern a meaning, and in the usual manner. NickyMcLean (talk) 11:40, 17 November 2015 (UTC)
replies: text: I think a large problem here is that "quantum bogosort" will never be an interesting "algorithm" from a computer scientific perspective -- a lot of the physics doesn't even make sense from a quantum mechanical perspective, e.g. "destroying the universe" will entangle the computer with the outside world, etc. I don't think anyone will have luck here arguing for it on the basis of being computer scientifically interesting. But it is notable in that it's a common joke, often mentioned in intro quantum computation classes, or sometimes jokingly when lecturing on diverse sorting algorithms. We have an article on spaghetti sort that seems to be there for the same reason. (A lot of the physical demands of spaghetti sort are many times more implausible than quantum bogosort. For instance, spaghetti sort requires exponentially large distinguishable spaghetti rods to represent n bits, which will easily end up creating a blackhole; if it were to not, it would still require faster-than-light communication to fall to the table. I would much rather be tasked with destroying the human race.) Quantum bogosort is a subject of popular culture that seems worth discussing, if not a subject of classical algorithms. Timeroot (talk) 22:30, 27 November 2015 (UTC)
thread_title:  In summary 

message: This article confuses two algorithms: what logic programmers call bogosort, and what other apparently call bogosort. The logic programmer's definition is:
 sort(I, P) :- permutation(I, P), sorted(P).
Read: "systematically generate all permutations, one by one, until you find one that is sorted". This algorithm has a worst-case running time of O((n+1)!) for an n-element input, not unbounded time like the randomized version. QVVERTYVS (hm?) 22:07, 5 November 2015 (UTC)
replies: text: As a CS major somewhat familiar with logic programming, I have never ever seen bogosort defined this way. Can you cite a source for the above definition? Zowayix001 (talk) 02:19, 28 January 2016 (UTC)
replies: text: Here is a university homework assignment that describes the Prolog algorithm as a deterministic bogosort. Interestingly, it also points out the connection. I'll update the article. QVVERTYVS (hm?) 09:42, 28 January 2016 (UTC)
thread_title:  Accuracy disputed 

message: Under example links, the github link to the Bogosort example in C is no longer valid.
Profsquid (talk) 10:31, 4 January 2017 (UTC)
thread_title:  Dead Link 

message: So I noticed that the Standard ML implementation doesn't use a very good shuffle algorithm. Using List.revAppend is nice but it only reverses the first component of the partitioned list. If you're sorting lots of reverse-sorted lists with this implementation, it's going to take a long time for the rightmost elements to random walk over to the left where they can start being shuffled properly. This could really bite someone who's using our example in their production code! What do people think about adding an additional List.rev like this?
fun shuffle xs = List.revAppend (List.partition rand (List.rev xs));
.froth. (talk) 16:28, 20 July 2021 (UTC)
replies: text: I was going to ask here if more than one language are actually necessary, seems like cruft (WP:LC). Also no one should realistically use bogosort "in production". Chininazu12 (talk) 09:48, 26 July 2021 (UTC)
replies: text: I was joking... and I actually agree about not needing multiple implementations in the article. The Python example is clearer, even for someone who doesn't know Python, and dodges the ML example's issue with the sketchy shuffle algorithm. I'll remove the ML code. .froth. (talk) 23:02, 26 July 2021 (UTC)
thread_title:  The ML implementation is not very efficient 

message: The article claims "Its name is a portmanteau of the words bogus and sort." But it isn't! So either this article is wrong or the definition of a portmanteau word is wrong. bogUsort would be a portmanteau word, for example.  — Preceding unsigned comment added by 88.97.62.77 (talk) 20:07, 27 February 2023 (UTC)
replies: text: Well may be it is from bogon or bogosity, but it's close enough. Graeme Bartlett (talk) 00:50, 1 March 2023 (UTC)
thread_title:  Portmanteau ? 

message: I think, the best case of miracle sort is O(n), which happens on a sorted list. 84.151.247.140 (talk) 12:07, 24 May 2023 (UTC)
thread_title:  miracle sort best case