5 ms·
Strangest Sorting Algorithms
- WantonQuantum 5y agoFor each number in the list, create an IT project with that many people on the team. The projects will finish in ascending sorted order.
- S4M 5y agoThat's just a more sophisticated version of sleep sort.
- charcircuit 5y ago>6 Stalin Sort >8 Intelligent Design Sort These don't sort the list.
- travisgriggs 5y agoSorted is in the eye of the beholder?
- dhosek 5y agoDie, heathen traitor!
- lmilcin 5y agoStalin Sort definitely sorts the list correctly. I hope I don't need to report you, comrade, for saying what is obviously a capitalist lie.
- samatman 5y agoNo algorithm sorts the list if it's already sorted.
- nkrisc 5y agoThat’s the wrong attitude if you’re using Stalin sort.
- throwawayninja 5y agobang Next!
- sudhirj 5y agoYour belief otherwise is either an evil capitalist lie or an insidious effort to undermine the principles on which your great nation is built. Either way you need to be shot unless you can start believing in the facts required for the greater good.
- trhway 5y ago>These don't sort the list. In this cases it is the list which sorts you. The end result is the same - the final observer perceives the list as sorted.
- niknoble 5y ago@dang I'm saddened to see this on HN. Should we really be platforming this kind of misinformation?
- papandada 5y agoPost list on an internet forum claiming you have sorted it (or maybe even better, that it's "unsortable"). Take list from angriest reply
- lmilcin 5y agoThat one could be implemented with sentiment analysis! And now we succeeded using AI and manual intervention for yet another problem that could be implemented with a simple classical algorithm.
- olliej 5y agoThat’s actually Murphy’s law
- LordRatte 5y agoYes. Because this isn't the response you were hoping for. It could go wrong so it did.
- lmilcin 5y agoAlgorithm #2 is also an algorithm that solves any problem as long as the solution is at all possible. Want to pass an exam tomorrow? Set the machine to destroy the universe two days from now if you haven't passed the exam.
- nevinera 5y agoI have doubts that destroying the universe can happen in less than O(N).
- aymar_99 5y agoInternet poll sorting: Create a poll asking to vote for the largest number, wait for results and put it at last. Repeat for remaining numbers. Oh wait that's selection sort. Nevermind.
- RcouF1uZ4gsC 5y agoThere is actually a better version of BogoSort that is deterministic. The C++ implementation is very elegant: while(!std::next_permutation(v.begin(),v.end())); The complexity is O(N!)
- skulk 5y agoit's even better, isn't it? next_permutation returns false once it rolls over and returns the sorted version so you can drop the negation.
- olliej 5y agoStrictly speaking that is the “correct” implementation of bogosort because it is deterministic (per my algorithms lecturer: for it to be an algorithm you must take the same steps each time for a given input. Obviously you could get around this by having the sort function take a seed and implement an RNG)
- kadoban 5y agoThere are various definitions of "algorithm", but that one seems needlessly restrictive. Randomized algorithms are a thing, and there doesn't seem to be much reason to exclude them, to me.
- olliej 5y agoI think the specific issue with the "randomly sort and see if its sorted" is that it is not guaranteed to ever complete.
- olliej 5y agoSleep sort only works if the time to enumerate the list and schedule timers is sufficiently small relative to the multiplier. I think a correct implementation would be sleep(x * k) where k is a constant factor determined by the platform