WorstSort: the WORST sorting algorithm
Вставка
- Опубліковано 6 чер 2024
- What was the worst event in 2016? goo.gl/forms/yJMOYvsVPlLt29nk2
So this was a good bit of fun to program. It is essentially a platter of all the worst sorting algorithms imaginable, starting with bubble sort and bogosort and moving onto one that is downright silly: worstsort.
I hope all the descriptions made sense. If you have trouble understanding anything, let me know and I'll try to explain it in the comment section.
Anyway, thanks again for popping in and watching / I'll see you next time!
The music came from Josh Woodward (sped up 1.5 times):
www.joshwoodward.com/
Please feel free to follow me on Twitter:
/ leiosos
Twitch (where I do all the simulations):
/ leioslabs
My second youtube channel (where I put the streams):
ua-cam.com/channels/Ff6.html...
or Github:
github.com/leios
The code I used is available here:
github.com/leios/simuleios/tr...
(sorry it's so messy)
Also, discord:
/ discord - Наука та технологія
Ok. I get it. 2020(1) was (were) objectively worse than 2016. If you watch until the end of the video, you will see that I said 2016 was nowhere near as bad as we thought it was and subsequent years could get worse.
I will redo this video sometime in the near future and focus explicitly on worstsort instead of the dumb joke that "2016 was the worstsort of year." Just realize that this video was made at a different era of educational youtube. Back then, it was not clear that doing a video on sorting algorithms would at all be successful. It was also one of the earlier videos on my channel, so the presentation is a bit odd.
Still, after rewatching it, I cannot say it's a bad narrative, just that the presentation and theme around 2016 were a bit off.
It looks perfectly fine to me. Good logical steps from beginning to end.
Okay, but... how many iterations do you do before using bubble sort? And how you decide that?
was about to comment this, good video
ps. I believe part of the reason of its success is *because* people feel the need to comment on how 2016 wasn't as bad of a year.. so maybe it works out
Was anyone actually upset about that line? If so, that’s ridiculous. I thought everyone was just poking a bit of fun.
Who knows… in a few years, maybe we’ll find it was naive to say “2020 was the worstsort of year”
I have even more worst sort idea. I call this sort Radiation Sort.
1. Check if the array is sorted.
2. If not, wait until a high energy natural radiation particle to hit the RAM and corrupt the array.
Since the particle can corrupt any part of the array, the array will be eventually sorted given enough time.
You can accelerate the process by putting some uranium ore in the computer.
This is basically just miracle sort
so you can change the time too and make it -1 secs
HOW DID YOU JUST MAKE BOGOSORT EVEN WORSE
bruh
lol
"2016 has been a pretty rough year" lmaoooooooooooooooooooooooo
God yeah
hahahhahahahahahahahah
2022
Laughing my ass off off off off off off off off off off off off off off off
2023 here.
Now its beter
"2016 was a pretty rough year"
uhh 2020 here... can we go back
2021 hasn't been that great either. I believe it will take less than two months for people to be satiated with being alone and we respectfully ignore further nonsense.
I'm just here to say hi to the guys in 2022
To 2019
2021
@@brunos6599 2021's been pretty good so far. There was a bit of 2020 spillover in Jan and Feb from events that 2020 caused, but so far, 2021's had the vaccine and dunking on Trump
Bogo sort could technically be the best algorhitm taking 1 step
you need n steps to verify that the array is sorted
so its best case is n
(creating a permutation needs n steps as well)
There exists a universe where bogosort sorted everything correctly the first time for as long as it has been used, and then, one day it just stops doing that.
Sorting Algorithm (Bogo%)
best-case: O(3n) (check for list sorting, randomize, check again)
average performance: O((n+1)!)
worst-case: O(inf) (can go on forever without getting the sorted list, but chances are infinitesimal.)
@@bluelandyaandgreenlandya1788 lmao thats actually true, and then after it eventually didnt work human civilization slipped an apocalypse
I'll have to tell people to use Bogosort when they suggest should we use bubble sort lol
Haha, only if you want to wait an incredibly long time!
Insertion sort is tha best
Well, I mean, it *can* be faster
bogobogosort:
watching the intro just after 2020 felt like being slapped
Yeah.
Thanks to the modern news cycle, every year is the worst year. If only we'd given as much attention to good news.
@@rkvkydqf idk, I feel like a worldwide pandemic where you weren't allowed to go out and socialise and people you know died from a disease was objectively the worst year of my life
@@meepmeepinton and we might get nuked now, because of the war!
@@meepmeepintonthe point flew way over your head
2020 is worstsort :(
Laughs in 2021
lol 2021
*l a u g h s I n 2 0 2 2*
@@petterlarsson7257 dear god no
@@petterlarsson7257 please no
“Yeah, it’s bad, but it could get a whole lot worse.”
2020: _Thankfully, things soon got worse._
Yeah actually, I want to go back to 2016 after this nightmare.
to be fair bubble sort is easy to implement.
Yeah, it's the first sorting algorithm that people typically learn, so there is that. =)
B̶u̶b̶b̶l̶e̶ ̶s̶o̶r̶t̶ is optimal (or was it Insertion sort?) on very small lists, so if you need to sort 1 billion lists of 10 elements instead of 1 list of 10 billion elements, it may be a choice :)
I vaguely remember a cool chart showing optimal algorithm vs list size, can't seem to find it anymore...
@@LeiosLabs why is that? i'm pretty sure our teachers did not show us all the sorting algorithms in the first semester. I vaguely remember being asked to sort a list in the lab and using my "own" method to sort it, which is selection sort. that is the most natural sorting algorithm for a person to come up with without any algorithm experience.
@@xXErr4rXx but it's harder to implement, and bubble sort is basically dumb selection sort which uses a lot of variable value assigning
@@xXErr4rXx but my first sorting algorithms I have figured out is the selection sort, when taking a IT competition for grade 5 students. I haven't been teach about that before, so that's the first one that come to my mind. It's hard to implement for elementary students, I have to even use the auxilarity array :))
What, no love for Bogobogosort?
Bogobogosort is sort of like a recursive bogosort.
Step 1: Define s as an integer.
Step 2: Set s to 2.
Step 3: Shuffle the first s elements of the list.
Step 4: Check if the first s elements are sorted. If they are not, return to step 2.
Step 5: Check if s equals the size of the list. If not, increment s and return to step 3.
Step 6: Return the now-sorted list.
What about bogobogobogosort
what about Bogobogobogobogobogo sort?
what about bogobogobogobogobogobogosort?
What about bogobogobogobogobogobogobogobogobogobogobogobogobogobogobogobogobogobogobogobogobogobogobogobogobogobogosort?
what about sort?
Hey guys, this video ended up taking a little longer than I wanted (it's past midnight here), so I am heading to bed right after uploading. I'll check in the morning and fix anything that went wrong.
If you found anything in the video confusing, let me know! I had some trouble figuring out the best way to describe worstsort, so the humor might have been lost a little.
As a side note, there is a small hum in the microphone. This will be removed in future recordings, sorry about the issue with this video!
Anyway, thanks again for watching. You guys are great! I hope you guys have wonderful New Years celebrations / stay safe. I'll see you in 2017!
"2016 was a pretty rough year"
Laughs in 2021
Nah 2021 is ok
pain
Now let me introduce you to "cosmic ray sort". We just check if the array is sorted already, if not we check again. This continues until the memory has been corrupted so bad through radiation and so on, that our array is now sorted. It's beautiful.
miracle sort
This array could be a sorted array but not be a permutation of the original array, so its not valid.
An example of another array like this is stalin sort.
1-Start from first number at array
2-If number at position N is bigger than number at position (N + 1) delete number N and check position N and N +1 again, if not go to step 3
3-N = N +1 and go back to 2.
Me watching in 2020. While he's frustrated about 2016🤦♂️🤦♂️
This is probably just bogo sort
thanks for your videos ..it always helps me smile. youve grown a lot since i subscribed to you at 23 subs
Woah, since 23 subs? That was forever ago! You are awesome!
If only they knew back in 2016
2020 called and wants its sort back
2016 was a rough year.
2020 wants to have a word with you.
2020: You have no idea.
2021: I’m way worse!
2022: *AMATEURS.*
I love this video because it reminds of all the small things that made a year bad
Me: sorting algorithms is the worst
Sorting algorithms: *among us versions of sorting algorithms*
We need to create "infinisort" where it loads every sorting algorithm running in threads parallel to one another. When bogosort then gets it right on the first try we'll then see who's laughing
just saying, what order for the permutations is correct?
POV: You are trying to find a comment that is not about 2016 vs 2020
My Spotify shuffle was a bogosort.
Hey uh
Sadly 2017 wasn’t the equivalent of worstsort
As far as we know yet, it’s 2020
Or it’s Bogobogosort but still absolutely terrifying either way
“2016 has been a pretty rough year”
ha. Ha. Haha.
We had no idea what was coming.
This isn’t really a sorting algorithm then, because it will never actually sort the list. It’s just a memory eater.
2016: I am the bad year!
rand(2000, 2019): No, I am!
U$#)#5: Amateurs.
???
2020: Amateurs!
Why didn't you implement sleepsort
I didn't have infinite time to show all the sorting algorithms
Let me guess it just does nothing and waits for the list to be somehow sorted by itself? :D
Worstsort: "Aw man! I have to figure out which array to test first, but I can't decide!"
Worstsort: "Aw man! I have to figure out which arrays to test first, but I can't decide!"
Worstsort: "Aw man! I have to figure out which arrays to test first, but I can't decide!"
Worstsort: "Aw man! I have to figure out which arrays to test first, but I can't decide!"
Worstsort: "Aw man! I have to figure out which arrays to test first, but I can't decide!"
Worstsort: "Aw man! I have to figure out which arrays to test first, but I can't decide!"
Worstsort: "Aw man! I have to figure out which arrays to test first, but I can't decide!"
Worstsort: "Aw man! I have to figure out which arrays to test first, but I can't decide!"
Worstsort: "Aw man! I have to figure out which arrays to test first, but I can't decide!"
Worstsort: "Aw man! I have to figure out which arrays to test first, but I can't decide!"
Worstsort: "Aw man! I have to figure out which arrays to test first, but I can't decide!"
Worstsort: "Aw man! I have to figure out which arrays to test first, but I can't decide!"
Worstsort: "Aw man! I have to figure out which arrays to test first, but I can't decide!"
Worstsort: "Aw man! I have to figure out which arrays to test first, but I can't decide!"
Worstsort: "Aw man! I have to figure out which arrays to test first, but I can't decide!"
Worstsort: "Aw man! I have to figure out which arrays to test first, but I can't decide!"
Worstsort: "Aw man! I have to figure out which arrays to test first, but I can't decide!"
Worstsort: "Aw man! I have to figure out which arrays to test first, but I can't decide!"
Worstsort: "Aw man! I have to figure out which arrays to test first, but I can't decide!"
Worstsort: "Aw man! I have to figure out which arrays to test first, but I can't decide!"
Worstsort: "Aw man! I have to figure out which arrays to test first, but I can't decide!"
Worstsort: "Aw man! I have to figure out which arrays to test first, but I can't decide!"
Worstsort: "Aw man! I have to figure out which arrays to test first, but I can't decide!"
Worstsort: "Aw man! I have to figure out which arrays to test first, but I can't decide!"
Worstsort: "Aw man! I have to figure out which arrays to test first, but I can't decide!"
Worstsort: "Aw man! I have to figure out which arrays to test first, but I can't decide!"
Worstsort: "Aw man! I have to figure out which arrays to test first, but I can't decide!"
Worstsort: "Aw man! I have to figure out which arrays to test first, but I can't decide!"
00:11
2016 has been a rough year
well that aged well
wow that jntro almost fooled me for thinking it was recorded in 2021
Watching this video in 2020 and 2020 is the...........
worstsort: who are you?
Bogo bogo sort: I dont even know
"Bro thinking 2016 was bad".
2020: "Hello I'm gonna eat this f***ing bat thanks."
The problem is that you’d need to stop the recursion somewhere to check the permutation. i.e. Worstsort Degree ∞ is not well-defined. Probably just do it in order once the degree exceeds a specified “worstness” degree.
what a very nice vid, i like the narrative you constructed ^^ and 2020 would deffo be equivalent to worst sort XD lets hope they wont make even worse algorithm tho :x
it took worstsort this long to determine that 2020-2022 were actually worse years
Does worstsort ever conclude? Even if you let it run for infinity, would it terminate at some point?
yes if you limit the recursive depth, at which point you run another sorting algorithm then it eventually concludes if you ignore memory limitation and such minor issues that pester us mortals
So? What was the result?
Which one was the worst according to the poll?
Most people said Anti-intellectualism, then Brexit, then the American election.
@@LeiosLabs how is "Anti-intellectualism" an event?
Objection! Worstsort can’t be considered a sorting algorithm because it never actually sorts anything. Plus, Slowsort is right there as an astonishingly slow algorithm, possibly one of the slowest algorithms (relative to how fast is possible for the same job) without wasting time doing nothing.
You know what is inefficient? Shuffle the array even if it’s sorted
If 2016 was bubblesort and 2020 was worstsort, 2025 is going to be worse than that.
Ultimabogosort:
Check if the list is sorted 0.00001 times.
If the list is not sorted: apply all types of bogosort.
Check now, 0.000001 times.
Not sorted: apply again, (amount of numbers) times.
Check now, 0.0000001 times
Not sorted: apply again, (amount of numbers)^2 times
Until computer explodes reality breaks to quantum radiation.
If it is still not sorted, even when reality is broken: Apply this one last time, then give up and put the list in sorted order.
Pov: your watching this in 2021 and laughing that he thought that 2016 was bad
2020 is worstsort
didn't know 2020 was sorted by worstsort
WorstWorstWorstWorst sort: start counting through all the real numbers. Oh wait, there are infinitely many real numbers. guess it'll never finish then.
how can you sort permutations?
2021: BOZOSORT
2020-2023: such bad orting algorithm doesn't exist
so wait, what’s the difference between this and bogobogosort?
Can we please invent a new worst sort for 2020 please
Welcome to 2022
Bruh you think 2016 was bad just wait till 2020 is here
Happy 2019!!!
I almost thought he was going to say 2020.
EVEN WORSE THAN BOGO SORT!?!
Does Worstsort actually necessarily halt? It seems to me that, if you get unlucky, it might go on literally forever.
Even if you are lucky, worstsort will go on forever.
Ok, that seems pointless then xD
I mean, sure, that was kind of the point of this, right? To be as bad a sort as possible.
But I feel like that shouldn't really count. The worst sorting algorithm should still, in principle, halt at some point, even if just probabilistically (as with Bogo Sort)
If it demonstrably doesn't halt then it isn't actually a solution (how ever bad it may be) to the problem in question, right?
LeiosOS isnt the definition of an algorithm that it will terminate after a number of finite steps? I dont know if that disqualifies worstsort from being a sorting algorithm.
The video is a simplified explanation and omits some details such as how many recursion levels to perform (as a function of the of the size of the input), but the algorithm actually stops (after a humongous number of steps) and yields a sorted list. The technique used is in a way the opposite of "divide and conquer" - we may call it "multiply and be conquered."
Miguel Lerma ahh, thank you for the clarification.
This is not a sorting algorithm, this is a hyperoperation disguised as a sorting algorithm!
The true worst sort is to do nothing.
3:17 yep
Yeah. This was made a few years ago. I don't know where we are now, but I figure it's around the bogo sort level.
LeiosOS quick reply! I'd say bubble sort, bring the world is actually going to peace -for now-
2:31 one must imagine sisyphus as a sorting algorithm
Well bogo sort is both the fastest and slowest algorithm or medium. Because it is completely random. It can solve itself in 1 or in 99^42372 it's impossible to tell because again it's random. Though the chance of you getting it correct in 1 goes down the more you add to the sorting list and because usually theres so much it's extremely rare to solve in 1 making it "technically" the slowest but it can be good
It's not a divide and conquer algorithm, it's a multiply and BE conquered algorithm.
If you're reading this in 2020, now's the time to try Stooge Sort.
I have something even worse. Quantum Worstsort.
I would explain it, but I am unable to provide exact instructions in our current phaneron.
Quantum bogo+worst?
can you invent a 2020/2021 sort then?
2016 was rough? Oh boy...
:| the second iteration isn't worstsort, it's worstworstsort... much like the difference between bogosort and bogobogosort. If worstsort actually worked like this it would never finish, it's already got much worse space complexity than bogosort as it is so I don't think you really have to increase the number of iterations
who's here in 2022 after the mud flood disaster?
...huh?
2023 is sucking!!! You got no idea! I miss 2021
What was the issue with 2016 exactly?
recursion sort
No no no the worst sorting algorithm is Bogobogosort
Oh, hunny. I can guarantee that 2017 is worse. Let's all agree that 2015 was the peak of humanity.
This video was made a year ago, when the internet was buzzing about 2016 being the worst year ever. We'll see what they say about 2017 in a few months.
Well?
both years seemed fine to me
willway1234 we fukked
2019 in Europe will be bad, really bad.
*2022 has entered the chat*
So not only is this sort very inefficient, does it also use a lot of memory and is unstable?
yup. Its impossible.
I don't remember 2016.
Bogo Sort is no sort algorythm (in my opinion).
Stooge Sort is worse than Bubble Sort!
I read the title in a British accent for some reason
Oh cool a new video (cools at release date) *oh no*
I am really trying to get a new one out today! It might be tomorrow, but soon (tm)...
This doesn’t count as a sorting algorithm because it will never be sorted if you keep using worstsort. You have to change to a real sorting algorithm eventually.
2016 was a great year
2016 was bad? i thought it was a good year.
2020 was WorstSort
try the bogobogosort
shouldve used bogo sort
Nah man, 2017 was fucking GREAT.
Reminds me of:
rand() % n;
Miracle sort?
Oh man, I love that one!
*Grins for so long then unexpected laughs
O(please god i beg for mercy)
Don't mind, just another comment from 2020/2021...
2016 was a bad year (lol) too bad no one could predict a World War In 2021, technically summer/fall of 2023 but we will get there when we get there
This concept, not to mention this algorithm, is objectively bad. All similar uses of this line of reasoning for algorithms that actually do perform sorting rely on induction to prove their reliability.
Here is how mathematical induction works. You first prove that it works for a list of 1 or 2 items, then use those facts to prove that you can use it to sort n items by breaking it up into smaller lists which can be sorted reliably. That way, you can sort any finite list of items.
1 item on its own is sorted, trivially. But 2 items infinitely beg the question. You have two permutations of 2, the right way and the wrong way. Which out of those two is right?
You want to sort permutations how, now? What counts as a proper sort for permissions? I'll answer this question that you didn't ask: at the bare minimum, you sort it so the right permutation comes first, then pick the first one. But the algorithm stalls on 2 items. You can't use it to sort 2 items, because you haven't even proved that that would work, much less than for 6 items. No induction, no proof.
For Bubblesort, you know it works for 1 or 2 items, then 3 works because the largest of 3 gets swapped to the end, leaving an array of 2 that you know that you can sort. The rest proceeds from there.
You haven't even done that for "Worstsort," which we don't even have a clear definition for. So you can't use it to sort more than a single item. Nothing has been proven. Just getting items in the right place is an afterthought to this whole line of thinking.
Even a lesser Bogosort can be proved to work eventually if it at least cycles through all permutations eventually. If your first element after shuffling is less than all other elements, you have a smaller list, which lesser Bogosort can sort.
Worstsort is incomplete and undefined. I wouldn't even use it to sort the worst things that happened after Bubblesort was invented.
You are a REALLY smart kid but you are only a kid so let me give you a tip from a more experienced guy, 2016 was no worse than any other year.
I was 24 when making this video, and it is about sorting algorithms. The meme at the time was that 2016 was the worst year, but I correctly predicted it would get worse. (Last line: 2016 is bubblesort. 2020 is probably worst sort... but even then, it could get worse.)
And guess whaah ??
Worst sort 😂😂
Its been 7yr :/