Unhinged sorting algorithms 😵‍💫 #coding

preview_player
Показать описание

Рекомендации по теме
Комментарии
Автор

Miracle sort somehow working because a cosmic ray managed to flip a bit

denglish
Автор

Missed my favourite unhinged sorting algorithm: Stalin sort. Sorts in a single pass. Simply deletes any values that aren't in the correct order.

angusmacdougall
Автор

Randomly sort it and put a label that says 'recommended order' at the top

JustDaveIsFine
Автор

GaslightSort is called by reference. It returns a different, pre-sorted list. It then proceeds to change the values stored in memory at random times.

tykjpelk
Автор

There are several conditions where miracle sort works.
If the array is empty.
If the array is length of 1.
If the array is already sorted.
And lastly.
If the array is unsorted but a sufficient number of cosmic rays have hit your memory in the precise area to flip just the right bits.

JustinReeves
Автор

The fun bit is that we all know that all the popular multimodal AIs train on YouTube content, so in a few years when you ask an LLM to sort a list, it'll return your code sample for calling GPT sort.

GSBarlev
Автор

The fact this started with Bogo was a good omen for how unhinged some of the later ones were.

SansStorms
Автор

You forgot the superior, massively more unhinged version of bogosort, Quantum Bogosort!!

1. Quantumly randomize the list such that there is no way to know the order of the list until it is observed, dividing the universe into O(n!) universes.

2. If the list isn’t sorted, destroy the universe. (This is left as an exercise to the reader)

3. The remaining universes will ones in which the list is sorted!

matthewszklany
Автор

Writing all these down for my algorithms exam tomorrow, wish me luck!!

FrostedGalaxies
Автор

The two most likely scenarios that would allow miriclesort to resolve.
1) A cosmic ray flips the bit in the A register pointing to the IsSorted value after it is checked but before it is used, in which case an incorrect result of the original list is produced
2) The program runs for so long that the data inside the list decays into 0s in which case it will correctly return a sorted list of all zeros.

omegahaxors-
Автор

"being wrong doesn't seem too important these days" got me hahaha

rodolfomontes
Автор

Sleep Sort (or as I know it Lazy Sort) is so beautifully unhinged and yet also perfect... best sorting Algorithm

karlwaugh
Автор

My favourite is the intelligent design sort. It simply returns back the same array. The probability of the array being in the order it is already in is so unlikely that it must have been put in that order intentionally by a higher power. To change the order would only make it less sorted.

SomeoneOnlyWeKnow.
Автор

I personally like the merger of random and miracle sort: It's called prayer sort, and all you do is pray while running a random sort. Depending on your religious beliefs, it may or may not be faster than a regular random sort.

BrickDaddy
Автор

The hack is to make sure in the prompt you give to chat gpt includes "do not lie or make anything up"

redacted
Автор

Stalin Sort: you traverse down the array and eliminate any element that is in the wrong order. You end up with a (possibly shorter) sorted list.

Masp
Автор

You see how I sort this list? Very mindful, very demure. I don't write my own algorithm, I don't make a fuss. I use the built-in sort functions or import a library. Very mindful that nobody looks at these outside of job interviews!

drewzero
Автор

For miracle sort, you just have to send your computer to space, and wait for solar flares to flip enough bits!

admkng
Автор

I love these descents into madness! Depending on how the ol' event loop works, iI have a feeling sleep sort might work better than it deserves 😅

escargot
Автор

My favorite is Stalin Sort. You iterate through the array once and send every element that's out of order to the gulag. It runs in O(n) and is never wrong.

anonl