3 ms·
I like Intelligent Design sort: > The probability of the original input list being in the exact order it's in is 1/(n!). There is such a small likelihood of th
by Sohcahtoa82 5y ago
I like Intelligent Design sort:
> The probability of the original input list being in the exact order it's in is 1/(n!). There is such a small likelihood of this that it's clearly absurd to say that this happened by chance, so it must have been consciously put in that order by an intelligent Sorter. Therefore it's safe to assume that it's already optimally sorted in some way that transcends our naïve mortal understanding of "ascending order". Any attempt to change that order to conform to our own preconceptions would actually make it less sorted.
https://www.dangermouse.net/esoteric/intelligentdesignsort.html https://www.dangermouse.net/esoteric/intelligentdesignsort.h...
- kjeetgill 5y agoOhhhhhh... fascinating! Is there a good metric for how well sorted a list is? Maybe for every pair of elements, how many are in the correct order? Given a random shuffle of a list, what are the chances that another shuffle would be more sorted? There's a life lesson in here, I know it...
- pedrosorio 5y agohttps://www.baeldung.com/cs/counting-inversions-array https://www.baeldung.com/cs/counting-inversions-array