3 ms·
There's faster sorting algorithms: 1) ZEN sort: O(0) a) It is build on the realisation that it is all about numbers that do not really mean anything. b) It c
by iofj 11y ago
There's faster sorting algorithms:
1) ZEN sort: O(0)
a) It is build on the realisation that it is all about numbers that do not really mean anything.
b) It converges to NOTHINGNESS.. while it deletes all data there is.
2) Intelligent design sort (also known as miracle sort) O(1)
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.
3) Numerology Sort: O(n)
a) Employ gematria to calculate a divine hash sum of all the elements of the array, taking O(n) time. The specific method depends on the data type, and is left as an exercise to the reader.
b) Use this value to seed your PRNG.
c) Using the PRNG, sample pairs of indices and swap the indicated elements. Do this 4n times.
d) If the array is not sorted at this point, you have likely made an error in computing your hash. A debugging message is numerologically embedded in the output array that will guide you.
(Gematria: https://en.wikipedia.org/wiki/Gematria https://en.wikipedia.org/wiki/Gematria )
4) Sleep sort: O(largest number to be sorted)
a) read a number to be sorted, call it n
b) start a new thread, that sleep n seconds
c) insert the number in the result array
5) Chuck Norris sort
Chuck Norris once wrote by far the fastest sort algorithm ever. In Python:
def sort(x):
# I will roundhouse kick any array that isn't sorted at this point. Twice.
return x
- _jomo 11y agoI'm surprised you didn't list Bogo Sort (Monkey Sort) where the array order is randomised (shuffled) until it is properly sorted: https://en.wikipedia.org/wiki/Bogosort https://en.wikipedia.org/wiki/Bogosort The Wikipedia link also lists the Goro-, Bogobogo, and Bozosort variants.
- robotkilla 11y ago> 5) Chuck Norris sort i thought it was more like: def sort(x): if x == gay || x == intelligent: return hate() elif x == president: return question_birth() return 1
- _0ffh 11y agoQuantum sort: O(n) 1. Use quantum device to randomize order of array 2. Check if sorted 3. If not sorted, destroy universe In all universes which are left, the array is sorted. (Dependencies: Many worlds interpretation, Doomsday device.) Edit: Formatting.
- iofj 11y agoWhat happens if you have a bug in there ?