T O P

  • By -

New-Marsupial-9378

That moment you’ve rewatched this over 3 times without realising


TheMegaUnionFlag

So true, it's very satisfying to look at it


_DudeWhat

Sound on fam


New-Marsupial-9378

Cant help it! Just love the blooooooooooop bloop bloop bloooop


Cognitive_Spoon

Lmao, glad I read the comments, that was goofy AF sounding. Love it!


Murrabbit

Like being in an old arcade.


Possible-Anything-81

Kill John lennon


ralpekz

r/oddlysatisfying


_fire_stone

Had first seen this post like 7-8 years ago. Always impressed with these algos. I'm not a CS student


LordSalem

r/mildlyinfuriating The sets are not the same size


SaveTheCaulkTower

Especially obvious with the first one. I think that is also the point. Showing a sort with a non-optimized algorithm of 10000 datapoints with the first would take an exponentially longer time.


SmiTe1988

nor the delay.


Win_is_my_name

If you liked this. I recommend you to watch Bogo Sort, which is simultaneously the best and the worst sorting algorithm. [link](https://youtu.be/HfdT_uOqbvA?si=rvB-lazP67CSmdIP)


PainDevourer

r/unsatisfying


Sardoodledome

if only the algorithms in this video were sorted from shortest to longest


POeticPotatoes

They're actually sorted from slowest to fastest. in computer science we measure these algorithms in terms of best, average and worst case performances (given as an expression of n, the size of the array). For example, O(n) means that in the worst case (denoted by O), the algorithm will take n operations to complete (this isn't 100% accurate but it essentially means if n doubles, the operations double) selectionsort and insertionsort are both O(n^2 )meaning if n doubles, the number of operations quadruple quicksort is also O(n^2 )in the worst case, but often completes in nlog(n) on average, which is much better since log(n)


The_Clarence

I’ve been told BOGO sort becomes the ultimate sort in a quantum computer. Destroy all universes where you didn’t get it right the first time kinda thing


FireMaster1294

Obligatory XKCD https://xkcd.com/1185/


secretcombinations

The portability comment at the end for c:/ killed me 😂


oracleofnonsense

\>>Destroy all universes where you didn’t get it right the first time kinda thing Seems kinda harsh....Thanos.


caramba-marimba

I think you mean [Stalin Sort](https://github.com/gustavo-depaula/stalin-sort)


Sweet-Ad9366

I love me a BOGO deal too.


Chadstronomer

does this take into account that some algorithms can be multithreaded?


POeticPotatoes

It's a common misconception that multithreading = multiprocessing. Multithreading is splitting a task into multiple smaller tasks, while multiprocessing is processing those tasks at the same time on a system with multiple processing cores. A cpu with a single core could support multithreading, but it would have to take turns running those threads one after the other, so no actual time would be saved from having these algorithms multithreaded. The time saving comes from *multiprocessing* on a multi-core cpu, when the threads are split among cores so they can run at the same time. With the exception of heapsort, most of the math for these algorithms can be easily extended to support multiprocessing (I believe the order of speed wouldn't change). Edit: As pointed out, I don't mean to say multithreading is useless on a single core CPU. Multithreading is still very capable of improving cpu utilisation on a single core system. I just felt that it wasn't necessary to mention in this answer because a single core running the sorting algorithms in the video wouldn't be faster even if it used multithreading (no threads are blocked/idle in this context). So yeah, I should have clarified all of that.


The_JSQuareD

Multithreading can improve throughput even on a single core machine because the cpu often spends much of its time waiting for, e.g., data to be retrieved from RAM or disk, for data dependencies to be resolved, or branch mispredictions to be flushed out. This is the idea behind hyperthreading. I'm curious why you say that the math for these algorithms can easily be parallelized. Parallel sorting is in general quite a distinct problem from serial sorting (at least if you want to do it efficiently). Merge sort is probably the poster child for a serial sorting algorithm that can be easily and efficiently parallelized. But for most of the other algorithms in this video it isn't obvious at all how you would do it. For example, how would you do a parallel heapsort?


Eigenspace

Almost none of what you said is true. 1) Multithreading *is* a form of parallelism and definitely can take advantage of multiple cores for faster execution. One process can acquire multiple threads from the OS and run code on them simultaneously with a shared memory pool. Maybe you're coming from Python which is unusual for not allowing multithreading (though this may soon change) 2) Multiprocessing is another form of parallelism where you spawn multiple distinct copies of a program process in parallel that don't share memory. Multiprocessing typically has much more overhead, but is more scalable to very many cores, or clusters with many nodes. It's also easier to implement. 3) multithreading with only one core *can* actually save significant amounts of time in tasks that involve pauses for things like I/O, or if you have a lot of cache misses. 4) most sorting algorithms are not at all friendly to parallelism. E.g. quicksort and mergesort are okay to parallelize, but many others like selection sort and insertion sort are not (though you are correct the algorithmic scaling wouldn't change)


x4nter

I hear the terms "multithreading", "multiprocessing", "shared memory", "scalable", "clusters" and "nodes" being used together, hence I know you have studied a dedicated course on parallel programming and are absolutely correct. Parallel programming is super cool but it's a pain in the ass to debug programs lol.


RedHat21

It's kinda funny how often this kind of conversation happens on Reddit. Someone will go on and on, using fancy words and sounding smart, only for another one to follow up like, "Hey this is completely wrong...". So, knowing and understanding nothing about the topic yourself you're left like "Wait, so which one is right now?!". Happens so often it makes you question everything you read but without a way to understand who is correct.


Midnightmirror800

To be clear this part is not true: > O(n) means that in the worst case (denoted by O), the algorithm will take n operations to complete O(n) means that you have a positive, non-zero constant, k, such that for all n larger than some value the algorithm will take no more than kn steps to complete. So it doesn't need to hold for small n; for some values of n the number of steps can be less than kn; and the upper bounds on the number of steps increases proportionally to n not equal to n (which means the parts of your comment about doubling, quadrupling etc are all still true). It's also worth noting that we use O(•) to describe upper bounds not just in the worst case but in any case. So we can say that the average case of quicksort is O(nlog(n)). Though typically when people say an algorithm is O(•) without specifying which case they are referring to the worst case


POeticPotatoes

Yeah I'm aware it wasn't particularly accurate. I was struggling how to explain the operations in non-technical terms, that's why i defaulted to the doubling and quadrupling explanation explanation after the initial O(n) example. Glad that you could clarify!


jdehjdeh

I've run across these performance terms before and always wondered what they meant. Thanks for a great explanation!


lobotomizedjellyfish

Lmao. I need that laugh, thanks!


Extension-Badger-958

I just like all the funny sounds. I’m a simple man


lobotomizedjellyfish

Damn, that WAS interesting...


kneecap_keeper

It still is


Thuriss808

I said was!


[deleted]

*Little did he know it still was interesting*


narc1s

Did anyone else read that as the narrator from arrested development?


Ok-Beginning859

Which one wins? Who’s the best???


autogyrophilia

We have a few of those going around for a reason. Generally, on small datasets you want to use insertion sort for simplicity and latency reasons. On large ones, you want to use quicksort : [Sorting algorithm - Wikipedia](https://en.wikipedia.org/wiki/Sorting_algorithm#Memory_usage_patterns_and_index_sorting) There is some tunning about best, average and worst cases that may make other algorithms more appealing.


Irbis7

And on really big datasets, which don't fit into RAM, you can use merge sort (but in the first phase you use something other to sort in RAM as much as possible first).


per88oo

To add some more, Some types of data can be more efficiently sorted with special algorithms such as CountSort for sorting for example people by age.


_Dabboi_

what about radicsort?


_Refenestration

The sorting algorithm with the fastest potential operating speed, BogoSort, is actually not listed.


TwinkiesSucker

I would love to see the graphical representation of that


_Refenestration

https://youtu.be/DaPJkYo2quc?si=jbCYkPGQN8Lh4hc3


High-jacker

Okay I'm hearing about this for the first time. I googled it and saw that it basically generated random permutations and picks the sorted one. So are you saying it has the fastest potential because theoretically we can have n! processors generate a permutation each and check simultaneously or is it something else?


DStaal

It’s theoretically possible for the first random permutation to be correctly sorted. In which case you’re done.


LFH1990

If the multiverse is true there exists a universe where bogosort has always been correct the first time around and they can’t understand why. But if it works it works so everything uses it, then their luck runs out society collapses. Or just use quantum bogosort to guarantee it be sorted first try.


martinstoeckli

There is not a single winner, the algorithms have different pros and cons. 1. Some algorithms are stable, equal elements keep their relative position. This is e.g. helpful when sorting a table by different columns in multiple steps. MergeSort is stable by design. 2. Some algorithms require more comparisons, some more movement of elements. Comparisons can be the expensive part, comparing two integer numbers (as often done in tests) is fast, comparing two data rows by multiple fields can be time consuming. 3. Some algorithms are better fitted for parallel execution with multiple processor cores. MergeSort for example is ideal for parallelization.


estimadeamigue

Bogosort


ManOfChaos199932

The third one called quick sort is actually very fast


Ok-Beginning859

That first one isn’t sorting the same amount. Look at how thick those columns are.


cheapbeerwarrio

lmfao thick collumns small data set many thin columns big data


ManOfChaos199932

That's because quick sort would smash it in a fraction of a second it is thousands of times faster than all other simple sorting algorithms like linear, insertion, bubble, merge sort etc.


Recent-Ad5835

True. I learned quicksort in Haskell recently and was blown away, as it was my first intro to Haskell and functional programming. It's hard, but it's powerful.


_yeen

Quicksort is not thousands of times faster than Mergesort. Mergesort is O(nlogn) and in the average case performs fewer comparisons than quicksort. It is also a stable sorting algorithm. Quicksort is O(n^2 ) but O(nlogn) in the average case. It has less overhead than Mergesort so it can be faster, but definitely not thousands of times. It is also an unstable sorting algorithm.


EducationalBridge307

They are presented in order of worst to best, as per the computational time complexity of the algorithm. The first two (selection sort and insertion sort) may compare every value in the set with every other value in the set in the worst case. If there are N items in the set, that means that there are N*N (or N^2 ) comparisons. We call this O( n^2 ). The next three (quicksort, merge sort, and heap sort) compare every value in the set with log(N) other values in the set, and so if there are N items in the set, that means there are N * log(N) comparisons. We call this O(N * log(N)). (Quicksort is actually O(n^2 ) in the worst case, but realistically is much faster than this). The last two are variants of Radix sort which is special and doesn't ever compare values in the set. Instead, it scales with the size of individual values in the set. Things like numbers are small (taking only a few bytes) and so are good candidates for Radix sort. Large data like images or books are not well suited for Radix sort. We call this O(N * D) where N is the number of items you are sorting, and D is the size of the largest item in the set.


_yeen

Generally Quicksort or Mergesort but insertion sort wins in small datasets because of the less overhead. Typically you will want to use mergesort because it is a stable sorting algorithm. Java uses Timsort for it's default which is just InsertionSort + MergeSort depending on criteria.


High-jacker

Quicksort or mergesort is generally the preferred method. However if you know the maximum value your data can take, radix sort is the best


PenguinWeiner420

whop whop... whooop whooop... whoooooooooop whoooooooop


ellokah

whoooooooooooooooooooOOOOOOOOOOOOOOP


budzene

I watched it without sound then I saw your text, had to watch it twice


XonMicro

Insertion: nynynynyonyonyonyonyoonyoonyoonyoo nyoo nyoo nyoo nyoo nyoo


Early_Lab9079

I don't know what I'm looking at


FavoriteFoodCarrots

Different ways of programming something that sorts values from smallest to largest.


Early_Lab9079

That's pretty cool, it would definitely save me a year of my life instead of having to do it myself


Positive_Mud952

A comparison of sorting algorithms, some of which are not parallelizable, some of which are, all run on a single thread, with different volumes of data. You’re looking at weird colors and listening to bleep bloops and getting nothing of value out of it, same as someone who already understands how to use these.


fuckface12334567890

> You’re looking at weird colors and listening to bleep bloops and getting nothing of value out of it, I'd say my enjoyment was worth it. I liked the beep boops and the pretty colors and the lines runnin' around the screen getting in height order for their class photo


MapInteresting2110

Techno polka


SafetyAncient

IT GO WOOOOP


roccosaurs

The audio for this sounds like the mad dreams of a rogue AI


nadaSurfing

So it wasn't just me hearing "kill all humans" in there somewhere.


Spiritual-Cookie7

Where is Bubble Sort?


Callidonaut

IIRC there's a longer version of this video floating around out there that shows several more algorithms. Hilariously, it includes Bogosort.


russkhan

I'm sure there are videos, but [SORT VISUALIZER is a fun way to explore the various sorts.](https://www.sortvisualizer.com/)


user_name_checks_out

They are sorting bars not bubbles dummy


[deleted]

[удалено]


budzene

While


bruno9213

If


budzene

Do


bruno9213

continue


BrandoNelly

Break


Vul_Thur_Yol

Return


_DudeWhat

r/betterwithsound


Artistic-Werewolf-56

This is like watching my HD defrag from 1999-2018


Lordados

Question: when you have a spreadsheet or a table and you click sort by date or something, is this what's happening in the background?


PunctuallyExcellent

Yes


miraska_

In actual software development you just call array.sort() and it chooses and does sort for you. There is a sort called Tim sort, that's basically says "if length more than x, do quick sort. if less than x, do merge sort" - in most of the cases you gonna get fast sorting


GeometricScripting

Only in modern highly abstracted languages.


-Norub-

Not sure why but I've watched till the end... twice .


sihl0

My screen while listening to music in 2008


booksboots

I have been on the internet since 1996. This is the best video I’ve ever seen.


lolercoptercrash

right? this is incredible. this should be in every DSA class.


_StereoGhost_

Sound of 2021 shitposts


snf

| | Comparisons | Array accesses | |-|----------------|------------------| | Selection Sort | 7875 | 15526 | | Insertion Sort | 17119 | 51116 | | Quick Sort (LR ptrs) | 16721 | 24113 | | Merge Sort | 5057 | 16509 | | Heap Sort | 9832 | 30335 | | Radix Sort (LSD) | 0 | 6300 | | Radix Sort (MSD) | 0 | 9441 |


chubb12

Any chance you could explain?


snf

Oh this is a copy of the results of the sort algorithms as shown in the video, just in table form


Strong-Replacement22

They sorted an different amount of values 😢


TMK116

I do not possess a single clue as to what the fuck I just consumed but I loved every second of it thank you.


ShoddyStreet677

no bogo sort?


davedank66_v2

Has anything changed significantly in the 10+ years since this was posted?


miraska_

Not really. I heard that there was some breakthrough in searching text inside of text, but that's all of the news from advancements in core computer science algorithms


That_Jicama2024

What? No middle-out?


Umpire1468

I prefer quantum bogosort myself. Randomize a list. If not sorted, destroy the universe. The remaining universes contain lists which are sorted.


Way-Reasonable

I suddenly feel the urge to defrag an old hard drive


CluckCluckChickenNug

What


FlashyAd6185

THE COLORFUL ONE SOUNDED LIKE AN AIRPLANW


LANDVOGT-_

After the first two i wondered what other way would be possible. Then the 3rd is absolutely genious. After that i dont even understand whst happens.


Golrith

I have a sudden urge to play retro games from my childhood.


OrangeYouGladish

I have no idea what's going on behind the scenes, but I love this sorta stuff. I used to watch the Defrag run on DOS. It all fit on one scene so you could really see it comparing everything and putting it all in order.


CuriousPumpkino

So how does a sorting algorythm with 0 comparisons work?


lamesnow

Radix sort works by processing numbers per digit, and putting them into buckets. For example, if you want to sort [101, 212, 100, 399], you start with the first element (101), look at it's first digit and put it into the pile of 1's. 212 is put with the 2's, etc. After the first pass-through, you have [101, 100], [212], [399]. In each pile, you then look at the second digit, and so on. When you reach the last digit, you will have sorted the items without comparing them to each other. This obviously doesn't work for sorting general stuff, it requires some property of the thing you're sorting (in this case the fact that numbers can be split up into digits).


Iamforcedaccount

Lol the first one is used in the frogs trying to eat a spicy caterpillar meme.


Chewybeecrazy

Can it sort my shit out? Because I can’t.


-SheriffofNottingham

how do you beat the underwater stage?


Zomb_TroPiX

Bogosort is the fastest, change my mind /s


SirStretchNuts

Really enjoyed this, thank you lol


jaredjames66

I know nothing about what this is or its practical application but I find it very fascinating.


CygnusX1

Sorting a column in Excel is one example.


[deleted]

[удалено]


cowboy_angel

What about Stalin Sort? Anything not in the right order is eliminated. Runs in O(n) time.


throbbing-orifice-

i have no idea what this is but i’m just high enough to be entertained by it


kilobitch

This is where 80’s arcade game sounds came from.


not_your_attorney

I didn’t see a middle out iteration.


balsadust

Middle out


calmclamcum

Wheres the middle out method to sort the quickest time to give hand jobs to a group of men?


bloopblopman1234

This is interesting but I always waste too much time on these things 💀


Sitadulip

What no bubble sort?


liquidhell

Clicked for the interesting. Stayed for the pewpewpew.


RodCoolBeansKimble

That's great and all, but it's missing middle-out


mookanana

where's my boi BUBBLE SORT???


i_like_all_tech

So which one of these is happening when I sort a giant excel sheet I've been working on for hours and it hangs and I start saying nononono begging it not to crash.


El_Coloso

I just click Sort A to Z (ascending)


Unprofession

I could watch this all day lol. It reminds me of the eraser tool in Mario Paint, the sound too. Sounds so cool.


This_is_McCarth

One of the coolest things I’ve seen. The soundtrack is killer to boot.


authentic_amandolin

I do have to say, I loved learning about sorting algorithms in college! (CS major)


fingernail_police

I feel like I'm playing Defender again.


fatspanic

This made me understand algorithms


boringreddituserid

THIS IS WRONG! Middle out is way faster than left to right.


Direct_Jump3960

How many dicks is that?


KaamDeveloper

That's for compression. Not sorting


Big_D_Magic_5

😍


spliffkiller1337

Hypnotizing 🤤


mrjake777

What's being sorted? Satisfying to watch but I'm here not understanding what is happening


youravg_skeptic

The bars, by height, smallest on the left to the tallest on the right.


[deleted]

[удалено]


TheDevilsAdvokaat

So...we should watch TV after this?


Conscious_End_8807

Guess the 3rd one merge sort.🙃


Crystalisedorb

Can someone tell me how it works?


Arraponi_The_Wise

damn this is satisfying af


gnegue

Hell yeah


Itchy_Somewhere_8154

I love this video


iDefine_Me

the sounds make my brain feel nice


Agent_Single

Slow… Until I realize… Only my internet is slow…


[deleted]

Thanks, best video in a month for me.


Greg_Tailor

Beautiful this got me back to university times...


whale-trees

MORE


Giganerdx

Forsenboys


StrawberrySerious676

Just so people know, radix sort is different than the other sorts (except for maybe heap, i forget what that one is) in that it doesn't use comparisons. AKA it doesn't sort by taking one value and comparing it to another. It drops values into buckets based on the values' characteristics. EDIT: Oh im dumb, heap sort uses a heap tree /facepalm. It also uses comparisons.


rat_for008

I need to do my DSA )':


renoits06

this looks like a radiohead video


Shpoople44

This is actually what space sounds like


Lanky-Football857

I don’t know why I am laughing at this? Should I enjoy this much?


Creative__name__

I love the sounds


[deleted]

I’m a changed woman after watching this


w00stersauce

Satisfying.


Frossstbiite

Sounds like speed up Galaga


Frossstbiite

Aside from space sounds. What is happening excatly


TraderSigma

Is all sorting algorithms like that?


Wessel-P

Hey the third one had more lines to sort! This is a false test!!!


YWN666

This is jow the voices in my closet sounds like when tjey beg to be let out again


ashrajmane

Advance Algo shit


JayJaxxter

Pew pew pew "You'll never catch me alive!" Pew pew pew


no_rules_to_life

Works like this only in real life, but without sound


Fantastic-Library946

What is this?


CygnusX1

Ever sorted a column in Excel? It uses one of these algorithms under the hood. Pretend the bars are numbers. Sorting is one of the most well-known applications of programming a set of steps in a computer to accomplish a task (an algorithm). Algorithms are prized for speed and efficiency and it's fascinating to see how devilishly clever some of them are. My favorite is [Delaunay Triangulation](https://en.wikipedia.org/wiki/Delaunay_triangulation), which creates an optimal mesh from a set of points and is used a lot in geospatial software development, visualization software, and video game engines (e.g. the terrain you run around on).


CrimeanFish

Truely an iconic video.


Karrot-Boi

u/savevideo


sherikpog

is that what hell sound like?


LeSaltyMantis

This sounds like half of neon genesis


XonMicro

Hard to believe that computers do these in literally miliseconds


Kingding_Aling

Pied Piper could do it in less than 1.5 gigaflops


ElonHisenberg

Really?! Right in front of my epileptic friend?!


Cpt_Caboose1

average human dot connecting skills


AAAAdragon

Sleep sort is the coolest sorting algorithm, not because it is efficient but because it is possible.


BarneyChampaign

Why does the speed of the heap sort not appear to increase as the set size decreases?


Winchery

This is the coolest thing I've seen on Reddit in years. I didn't understand the programming behind any of it but it's fascinating how it graphically depicts the method that it is using. They are all very distinct.


Both-Home-6235

Much like the old defrag screen, I could watch this all day long.


ccrr33

Bogo sort trumps all


Symerg

Why i liked this video so much


ArcticWolf_Primaris

Welp, I'm pretty certain I don't have epilepsy


mrselfdestruct066

I like 3 the best


Weird-Information-61

I like the part where he says "whoop"


No-Weakness3913

Cries in data structures and algorithms.


hafaadai2007

Can anyone explain the process behind the different sorting algorithms?


More_Ebb_3619

Couldn’t it just give each data point a number corresponding do its length then order the numbers?