Every Sorting Algorithm Explained in 120 minutes (full series)
Ғылым және технология
This is a compilation video of the 4 existing sorting videos on my channel.
Visualizations: • Visualizing 70 Sorting...
• Explaining EVERY Sorti...
• Every Sorting Algorith...
• Explaining EVERY Sorti...
• The Perfect Sorting Al...
Corrections / clarifications: none so far
Resources I mentioned in section 4:
itbe.hanyang.ac.kr/ak/papers/t...
en.wikipedia.org/wiki/Block_sort
github.com/BonzaiThePenguin/W...
github.com/HolyGrailSortProje...
habr-com.translate.goog/en/ar...
Chapters:
0:00 Intro
1:34 Selection
2:04 Double Selection
2:30 Insertion
3:07 Binary Insertion
3:56 Bubble
4:28 Shaker
4:46 Asymptotic Notation
7:40 Finding Time Complexity
9:48 Quick
11:51 Merge
13:10 Stability
14:11 Space Complexity
15:57 Heap
18:46 Comb
20:05 Shell
21:28 Radix LSD
25:28 Radix MSD
26:11 Bucket
28:58 Counting
30:26 Spaghetti
31:03 Gravity
32:33 Pancake
33:45 Bogo
34:53 Section 2 Intro
35:16 Cycle
35:55 Patience
37:04 Exchange
37:49 Odd-Even
38:12 Circle
39:13 Merge-Insertion
40:13 Tournament
41:00 Tree
42:09 Gnome
42:41 Library
43:28 Strand
44:20 Topological Sorting
45:18 Sorting Networks
46:57 Bitonic
48:43 Odd-Even Network
49:07 Pairwise Network
49:42 Why Hybrid Algorithms?
52:34 Quick LL
52:59 Dual Pivot Quick
53:53 Proportion Extend
54:40 Intro
55:21 Pattern Defeating Quick
57:06 Tim
58:54 Iterative Merge
1:00:20 In Place Merge
1:01:10 Weave
1:01:42 Rotate Merge
1:02:59 Quad
1:04:37 Block Sort Preview
1:05:08 Weak Heap
1:08:19 Smooth
1:11:23 Poplar
1:11:52 Ternary Heap
1:12:26 In Place Radix MSD
1:13:45 Binary Quick
1:14:09 In Place Radix LSD
1:14:53 American Flag
1:15:57 Burst
1:16:21 Spread
1:17:19 Sample
1:18:05 Proxmap
1:18:24 Cartesian Tree
1:18:56 Section 4 Intro
1:23:05 Outline
1:25:29 Sqrt
1:30:05 Block
1:36:39 Wiki
1:41:57 Grail
1:50:07 Stooge
1:51:06 Slow
1:52:08 Quantum Bogo
1:52:33 Stalin
1:53:36 Sleep
1:53:56 Miracle
1:54:20 Bogobogo
1:55:24 Power
1:56:09 Outro
#math #sorting #algorithms #explained #math #computerscience
Пікірлер: 154
Visualizations: kzread.info/dash/bejne/h6Vqt7Szn5zXZso.html I hope you enjoyed learning about algorithms! And for returning viewers, I hope you enjoy the trip down memory lane!
@Johnny_Franco-12_Scratch
Ай бұрын
こんにちは、クヴィナ・サイダキ!
@CaptainDangeax
28 күн бұрын
Great vidéo. I'm gonna play with my C128 ASM just for the fun of it, trying to implement some of them and programming the VDP
@truongquangduylop33
5 күн бұрын
did musicombo wat ch this video
genuinely love the way you've adapted this into a worlthwhile viewing experience rather than just a compilation, the little titles are so cute, and the new bits of voiceover make this feel like it was always supposed to be one huge video.
@M113sAldrich
15 күн бұрын
I was going to make that Adam Sandler joke but I understand why you are here
kuvina i am rooting for you
@jan_Eten
Ай бұрын
mood also omg is ðat patricia taxxon ( 'o') i loved your love rap explanation in rhythm heaven iceberg megamix ( ^u^)b
@MarkusIfquil
Ай бұрын
patricia ily
@RadioactiveBluePlatypus
Ай бұрын
Omg hii you're my favorite autistic furry youtuber yippee! /genuine Helped me realize I'm autistic myself
@temmie1662
Ай бұрын
@@RadioactiveBluePlatypusoh oh hi /gen
@paper2222
Ай бұрын
our favorite enby buddy
Have I watched each of the individual videos before? Yes. Will I watch this compilation? Absolutely.
@wyattstevens8574
Ай бұрын
There's also a visualization-only companion!
@maadneet
Ай бұрын
@@wyattstevens8574 Watched that too!
does anyone else ever get annoyed at Quick Sort being called Quick Sort, like that just feels unfair to the rest of the sorts. why isnt it called like "Partition Sort" or something
@mistymysticsailboat
Ай бұрын
and like it Clearly has weaknesses. it is horrible on an already sorted list.
@Kettwiesel25
29 күн бұрын
Pivot sort is more descriptive I think
@pangpanggao
Күн бұрын
I think it is partly due to the fact that it was a super fast algorithm when introduced, so they just called it quick sort.
Two hours of high quality and well-thought-out content? Am I dreaming??
There goes my plan to make a sorting algorithm explanation. I can just redirect people here now.
@EntergeticalakaBot
Ай бұрын
There goes the ideas, being used by others
@realmless4193
Ай бұрын
Just checked out your channel because of this comment. Did subscribe.
The idea of sorting networks is really reminding me of how factorio balancers work
@robertmauck4975
26 күн бұрын
That was my first thought too
@octopodes_nuts
11 күн бұрын
I would not be surprised if there's Factorio builds that contain otherwise-unknown algorithms that beat any documented method, whether sorting or some other interesting task
Here's a favorite joke algorithm of mine: Intelligent Design sort. It works like this: First, observe that the probability of the array being in the exact order that it's in by chance is 1/(n!), this is so unlikely that we must conclude that the array was put in that order by an intelligent Sorter, who must have sorted the elements by some metric beyond our mortal comprehension. This means that any change we might make to the array would actually make it _less_ sorted, which would be against the Sorter's plan. Therefore, the algorithm is complete. This has O(1) Time Complexity.
Forever proud of actually using bogosort back in uni and getting it accepted
@m_affiliates
6 күн бұрын
Please elaborate
20:38 there is an among us hidden in the purple bar
@jan_Eten
Ай бұрын
yeah i know
@wyattstevens8574
Ай бұрын
Didn't notice that!
@theunknown4834
Ай бұрын
Really something among us
@Spax_
25 күн бұрын
went looking for this comment
Someone should make a paranoid sort algorithm, like bubble sort, but it swaps items a random amount of times just to make sure it's actually swapped, and should have a save function it spams just in case it crashes. You can also make it randomly mess up or starts over completely, maybe even go through twice and compare the two finished sorts to see if it got the same outcome before determining if it's sorted or not
I'm a huge fan of all of the icons! They are all very clean and well designed! Great work on all the visuals and research in the series!!
I’m learning math and science for college majors at 10:30pm. I fell proud.
genuinely I love this so much. I do not know enough math to keep up with your descriptions 100% of the way, but what I can parse is genuinely very interesting. I love sorting algorithms, and I love learning more about how they work, even if I can never fully understand it. Thank you so much for this video! I was enraptured all the way through.
@mithrilbookofmystery
26 күн бұрын
Ahhh I lied I was actually still watching - near the beginning - when I wrote this but by god I am still enraptured. I'm going to start commenting on the little things I'm enjoying as I go along, because there are many, and I couldn't stop myself at just the one comment. First of all: I love your explanation of the use cases for these algorithms. Or, well, I'm currently just in merge sort, I'm unsure if you keep doing it down the line, but still! it's cool to know the pros and cons of each sort, and why one algorithm would be used over another, as in your city name sorting example.
@mithrilbookofmystery
26 күн бұрын
20:38 >:0!!!!!
gotta admit, 80% of block sort flew over my head after sqrt, but i loved this entire video anyway, thank you so much
sorting algorithm i made (and probably many others too) so, i started with bogo, but then tweaked the randomiser function. it was originally picking 2 random values and swapping them i changed that "swapping" to "comparing" them. i don't know what to call it, but it does work quite well as a sorting algorithm.
@antoninduda9078
Ай бұрын
I think it's called either bubble bogo sort or exchange bogo sort
bubble sort and shaker sort are definitely the most intuitive for me, as i've unknowingly been doing smth very similar my whole life for real-world situations!
@HesterClapp
Ай бұрын
I think insertion sort is more intuitive than bubble sort. Bubble is easier to code, but it's harder to convince yourself that it works
@not_estains
23 күн бұрын
i use radix lsd base 2 sort irl
Very nice video. Regarding the bonus section at the end -- you'll no doubt be pleased to hear that the latest SIGBOVIK conference introduced bogoceptionsort! Bogosort may accidentally sort very small lists correctly in only a few iterations. To prevent this, bogoceptionsort first shuffles the *order of the lines of code* that make up the bogosort implementation, then attempts to run it, then checks to see if the list is sorted. This effectively pads the number of elements in the list, making it perform extremely poorly for even lists of size, like, five.
I don’t understand any of how block sort works but I’m glad computers do
1:52:30 Quantum bogosort is actually implementable, but would be O(2^n) in all cases, since you need to spend time creating those 2^n “worlds” to destruct. There is another interesting sorting algorithm, which is the “differentiable sorting” algorithm. It takes in a list and returns the permutation required to make it sorted, but the entire algorithm can be differentiated (needed in ML and for incremental computation).
@MichaelDarrow-tr1mn
Ай бұрын
actually o(n!)
20:38 Quite suspicious indeed
Fantastic Work !! very impressive
I came looking for one of those “every __ explained” videos but i got something much better
Hey, just to letcha know: you are more than welcome to join The Studio so you can stay updated on Holy Grailsort's progress (once we come out of hiatus, which is hopefully soon)! ❤❤
This series of videos inspired me to create a sorting algorithms visualization that runs on my CASIO graphical calculator, I implemented 16 different algorithms and it was really fun. Thank you. Great video, very helpful and interesting.
Once again, your explanation for Grailsort makes me smile ❤
kuvina, patricia taxxon and jan misali should all collaborate sometime
49:56 this feels so much like a meme template and i love it
i will not need this information. but it begs to be watched
bitonic sort visualizes the swaps that are needed to make a belt balancer in the video game Factorio lol
22:10 I may have mentioned this in the original video, but radix sort *can* be used on strings (as long as characters have a fixed-size representation). It's most efficient with fixed-size strings, but can even be used on variable length strings.
How much sorting algorithm do you want? Me: *_Yes_*
Stumbled across this awesome video and liked it 5 minutes in. It’s great, but I would suggest adding a touch more emotion in to it. Great video!
Great work, congratulation. Certainly watch one time is not enough. But understanding level again increased in my situation.
I am less than a minute into the video and I need you to know that I love you
A variation on quantum bogo sort (without the universe destruction): Step 1) go through the entire list to see if it’s sorted, also counting what n is in the process Step 2) with n! parallel processors and n! auxiliary arrays, distribute each element evenly into each open spot in each array, which guarantees that each array is distinct* Step 3) because each auxiliary array is necessarily distinct, and we have n! number of them, exactly one must be sorted. Simply use all our parallel processors to comb through them simultaneously to find the sorted list. Boom, the fasted on average sorting algorithm possible (time complexity of n) The only issue would be the space and processing it requires…
@skittlez0496
27 күн бұрын
*if the list doesn’t contain strictly distinct values, there will be multiple auxiliary arrays which are sorted, but still only one that is sorted stably We can make this algorithm stable by taking the first auxiliary array (which is necessarily just a copy of the original list) and use it as a “stable” memory storage to help find the one true stably sorted list
ive already seen all 4 videos, is there anything new in this one?
@Kuvina
Ай бұрын
not really I just redid some audio and visuals to make it easier to watch, and added segues between the sections
Now I can understand the things
you should do a longer video about joke algorithms (especially more obscure ones like hanoi sort), theyre very fun
Great work. Thanks
very enjoyable, thank you. shell sort is indeed a favorite.
I'm pretty sure I said this on the original video, but when we got to the sorting networks and bitonic, my mind goes to Factorio belt management theory.
i am trying to make a sorting visualizer in python by using your terminal and using pygame for the sounds. i didn't understand many sorting algorithms but this helped me understand some of the algorithms. i also included one of your sorting algorithms (baiai sort) inside. thank you for the explanation and peace.
you make the best videos!
each algorithm has a little icon !? very cute i love it
Honestly quite incredible
Baiai sort can also be called Odd Even Insertion(because it’s also “odd even”ish.
Minor typo - 1:05:15 says O(nlgon) instead of O(nlogn) in the magenta rectangle
new Kuvina video! I already love it
Wasn't there an algorithm that can solve any NP-problem in its minimal time complexity by random generating algorithms and checking if there answer is correct? It's just generliced bogo-sort, but would have been worth a mention.
pairwise bogo sorting network: given a list X of size n, generate a new list P containing all ascending pairs of integers from 0 to n-1. shuffle P and use it to compare every pair of numbers in X, swapping them if necessary. if X isn't sorted throw your computer in the ocean or something idk
@fwuz_
5 күн бұрын
update: i made it and it's every bit as horrible as i had hoped
Are there different considerations based on properties of the data, like numerous peices of data with the same values? In such a data set is there anything of note happening when a secondary sort method is used? (Like sorting files by album title, and secondarily by name, or track number? What about if the data is already partly sorted instead of random?
@Kuvina
Ай бұрын
That's where adaptive algorithms come in, which are covered in part 3 !
@NXTangl
Ай бұрын
For "A-then-B" you can just sort by A but break ties by B, or you can sort by B, then stable sort by A, or you can use a recursive procedure more like MSD radix sort.
@LeoStaley
Ай бұрын
@@NXTangl does anybody know how windows explorer does it?
@NXTangl
Ай бұрын
@@LeoStaley Probably stable sort.
Radix Sort could work on any set of finite elements.
yay new kuvina video :3
@proton..
Ай бұрын
as pictures
@Living_Murphys_Law
Ай бұрын
as pictures
I think I saw somewhere that the time complexity of Shell sort is O(n (log n)^2), which is roughly n^1.2, but I couldn't tell you why that's the time complexity
@Kettwiesel25
29 күн бұрын
O(n log^2 n) is a smaller time complexity than n^1.2 or even n^1.00001
You're the best
I'm only at the start of the video right now, but I just want to note that ska sort doesn't seem to be included.
1. Quicksort can include smarter pivot-selection techniques to guarantee O(n*log(n)) time in the worst case. 2. Shellsort can be O(n*log(n)^2) if you choose the sequence of gaps more carefully. Additional details in replies.
@circuitcraft2399
Ай бұрын
Explanation for 1: there is an algorithm called "median of medians." It is an O(n) algorithm that finds some value in the list that is greater than (or equal to) at least 30% of the others in the list, and also less than (or equal to) another 30% of them. By using it to choose pivots, we will always shrink the list by a constant factor on each step, guaranteeing logarithmically-many recursive steps.
@circuitcraft2399
Ай бұрын
Explanation for 2: if we choose the sequence of 3-smooth numbers, we never swap an element more than once on a given iteration. Since there are O(log(n)^2) 3-smooth numbers less than n, we perform that many linear-time iterations.
which one is most used in practice?
this is so good
radix sort is so cool
identity crisis sort should randomly start off with quick or merge
cool now i can watch this when binging it the 581st time
this is fucking cinema
now explain every shuffling algorithm
1:05:13 Typo! "and building it is O(nlgon)"
@Kuvina
Ай бұрын
I'm impressed by how many people have noticed that. But I guess it shows people are really paying attention to the video!
marvel moieverse been real quiet since this dropped
Whatt is a pivot???????????????
Can't wait to get hired at Google/Facebook/Papa Johns
Fun fact, Bill Gates published a really neat paper on pancake sort! I wish I was smart enough to understand it. I'd watch a video of someone explaining that paper online.
Bogo sort is the best
Wow, just wow
Top sort is not obscure :(. It is used in every DAG problem basically.
I keep hearing login
Fireship ahh video lawful evil ending
OMGZ block sort!!!
Already a major mistake at only two and a half minutes. And the runtime complexity of selection sort isn’t even difficult to calculate.
1:05:16 nlgon
1:05:14 O(nlgon)
woohoo!
Grade 12 math was not enough for this video XD
Didn't even mention worstsort 0/10
among
Its 117.55 minutes long
@user-jp7zr9gr3n
Ай бұрын
Не души, Владос
Yooooooooo.
Hey great video you put effort into, but I got some small problems about your intro jingle It doesn't sound pleasant since there is too much tension which isn't resolved nicely meaning it sounds like it's not done and unsatisfaction. (I assume the first note is the home note or the note that sounds at rest). I may be wrong, and that is supposed to be like that because of the message you're supposed to show. But if not, I can help make a better one because I understand some music theory and I'm a newbie. Thanks for reading
11h ago
45th view
1:05:14 nlgon xD mi jan lukin nanpa san ale san mute san
Helloooo :3
@jan_Eten
Ай бұрын
hoi!
@temmie1662
Ай бұрын
@@jan_Eten aaaaa :3
Sigma algorithm: It will say erm what the sigma and then and checks if the array is sorted, if not, it repeats
first :D
@Lev3759Mc
Ай бұрын
Confirmed with newest first comments
gnome sort is my favorite