Every Sorting Algorithm Explained in 120 minutes (full series)

  Рет қаралды 31,595

Kuvina Saydaki

Kuvina Saydaki

Күн бұрын

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

Пікірлер: 136
@Kuvina
@Kuvina 20 күн бұрын
Visualizations: kzbin.info/www/bejne/i6KZhoWwpJ6kbMk I hope you enjoyed learning about algorithms! And for returning viewers, I hope you enjoy the trip down memory lane!
@Johnny_Franco-12_Scratch
@Johnny_Franco-12_Scratch 13 күн бұрын
こんにちは、クヴィナ・サイダキ!
@CaptainDangeax
@CaptainDangeax 11 күн бұрын
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
@Patricia_Taxxon
@Patricia_Taxxon 19 күн бұрын
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.
@Patricia_Taxxon
@Patricia_Taxxon 20 күн бұрын
kuvina i am rooting for you
@jan_Eten
@jan_Eten 19 күн бұрын
mood also omg is ðat patricia taxxon ( 'o') i loved your love rap explanation in rhythm heaven iceberg megamix ( ^u^)b
@MarkusIfquil
@MarkusIfquil 19 күн бұрын
patricia ily
@RadioactiveBluePlatypus
@RadioactiveBluePlatypus 19 күн бұрын
Omg hii you're my favorite autistic furry youtuber yippee! /genuine Helped me realize I'm autistic myself
@temmie1662
@temmie1662 19 күн бұрын
@@RadioactiveBluePlatypusoh oh hi /gen
@paper2222
@paper2222 18 күн бұрын
our favorite enby buddy
@maadneet
@maadneet 19 күн бұрын
Have I watched each of the individual videos before? Yes. Will I watch this compilation? Absolutely.
@wyattstevens8574
@wyattstevens8574 19 күн бұрын
There's also a visualization-only companion!
@maadneet
@maadneet 19 күн бұрын
@@wyattstevens8574 Watched that too!
@ultra824
@ultra824 15 күн бұрын
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.
@yellowmarkers
@yellowmarkers 20 күн бұрын
There goes my plan to make a sorting algorithm explanation. I can just redirect people here now.
@EntergeticalakaBot
@EntergeticalakaBot 19 күн бұрын
There goes the ideas, being used by others
@realmless4193
@realmless4193 19 күн бұрын
Just checked out your channel because of this comment. Did subscribe.
@mistymysticsailboat
@mistymysticsailboat 15 күн бұрын
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
@mistymysticsailboat 15 күн бұрын
and like it Clearly has weaknesses. it is horrible on an already sorted list.
@Kettwiesel25
@Kettwiesel25 12 күн бұрын
Pivot sort is more descriptive I think
@MonitorLizardGaming
@MonitorLizardGaming 19 күн бұрын
Two hours of high quality and well-thought-out content? Am I dreaming??
@samanther511
@samanther511 19 күн бұрын
The idea of sorting networks is really reminding me of how factorio balancers work
@robertmauck4975
@robertmauck4975 9 күн бұрын
That was my first thought too
@FinnPlanetballs
@FinnPlanetballs 20 күн бұрын
20:38 there is an among us hidden in the purple bar
@jan_Eten
@jan_Eten 19 күн бұрын
yeah i know
@wyattstevens8574
@wyattstevens8574 19 күн бұрын
Didn't notice that!
@theunknown4834
@theunknown4834 15 күн бұрын
Really something among us
@Spax_
@Spax_ 8 күн бұрын
went looking for this comment
@colly6022
@colly6022 19 күн бұрын
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
@HesterClapp 19 күн бұрын
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
@not_estains 6 күн бұрын
i use radix lsd base 2 sort irl
@evanzieg
@evanzieg 19 күн бұрын
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!!
@josephgaming3357
@josephgaming3357 19 күн бұрын
I kinda want to know what all the algorithms would look like if you started with a reverse order list instead of a shuffled list. is there somewhere I can see that?
@ceremyjlarkson9475
@ceremyjlarkson9475 19 күн бұрын
20:38 Quite suspicious indeed
@epikoof
@epikoof 19 күн бұрын
gotta admit, 80% of block sort flew over my head after sqrt, but i loved this entire video anyway, thank you so much
@krabman6297
@krabman6297 14 күн бұрын
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
@lerq0ux
@lerq0ux 16 күн бұрын
I came looking for one of those “every __ explained” videos but i got something much better
@ishu4227
@ishu4227 14 сағат бұрын
49:56 this feels so much like a meme template and i love it
@epikoof
@epikoof 19 күн бұрын
kuvina, patricia taxxon and jan misali should all collaborate sometime
@CombineCubing
@CombineCubing 19 күн бұрын
How much sorting algorithm do you want? Me: *_Yes_*
@joelicandi2586
@joelicandi2586 15 күн бұрын
Fantastic Work !! very impressive
@ManicVolcanic
@ManicVolcanic 11 күн бұрын
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.
@mithrilbookofmystery
@mithrilbookofmystery 9 күн бұрын
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
@mithrilbookofmystery 9 күн бұрын
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
@mithrilbookofmystery 9 күн бұрын
20:38 >:0!!!!!
@mrtopper930
@mrtopper930 11 күн бұрын
I’m learning math and science for college majors at 10:30pm. I fell proud.
@Skyb0rg
@Skyb0rg 19 күн бұрын
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
@MichaelDarrow-tr1mn 14 күн бұрын
actually o(n!)
@migueltorrinhapereira7473
@migueltorrinhapereira7473 17 күн бұрын
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.
@jursamaj
@jursamaj 19 күн бұрын
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.
@Musicombo
@Musicombo 19 күн бұрын
Once again, your explanation for Grailsort makes me smile ❤
@augie279
@augie279 12 күн бұрын
I don’t understand any of how block sort works but I’m glad computers do
@namethathasntbeentakenyetm3682
@namethathasntbeentakenyetm3682 20 күн бұрын
Now I can understand the things
@kaderen8461
@kaderen8461 14 күн бұрын
i will not need this information. but it begs to be watched
@thumbgoblin4716
@thumbgoblin4716 20 күн бұрын
ive already seen all 4 videos, is there anything new in this one?
@Kuvina
@Kuvina 20 күн бұрын
not really I just redid some audio and visuals to make it easier to watch, and added segues between the sections
@SysFan808
@SysFan808 16 күн бұрын
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
@antoninduda9078 13 күн бұрын
I think it's called either bubble bogo sort or exchange bogo sort
@mommyuki
@mommyuki 20 күн бұрын
new Kuvina video! I already love it
@DavidvanDeijk
@DavidvanDeijk 17 күн бұрын
very enjoyable, thank you. shell sort is indeed a favorite.
@wiktorszymczak4760
@wiktorszymczak4760 11 күн бұрын
Forever proud of actually using bogosort back in uni and getting it accepted
@ryanbartlett672
@ryanbartlett672 17 күн бұрын
Great work. Thanks
@CompilerHack
@CompilerHack 19 күн бұрын
you make the best videos!
@skittlez0496
@skittlez0496 10 күн бұрын
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
@skittlez0496 10 күн бұрын
*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
@Musicombo
@Musicombo 12 күн бұрын
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)! ❤❤
@ERRORRubiksZeraBrand
@ERRORRubiksZeraBrand 12 күн бұрын
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.
@mitchellbailey5522
@mitchellbailey5522 2 күн бұрын
Honestly quite incredible
@arcainchaos
@arcainchaos 17 күн бұрын
I am less than a minute into the video and I need you to know that I love you
@12times12_
@12times12_ 15 күн бұрын
bitonic sort visualizes the swaps that are needed to make a belt balancer in the video game Factorio lol
@fuschia-draws
@fuschia-draws 9 күн бұрын
each algorithm has a little icon !? very cute i love it
@circuitcraft2399
@circuitcraft2399 18 күн бұрын
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
@circuitcraft2399 18 күн бұрын
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
@circuitcraft2399 18 күн бұрын
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.
@LeoStaley
@LeoStaley 20 күн бұрын
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
@Kuvina 20 күн бұрын
That's where adaptive algorithms come in, which are covered in part 3 !
@NXTangl
@NXTangl 19 күн бұрын
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
@LeoStaley 19 күн бұрын
@@NXTangl does anybody know how windows explorer does it?
@NXTangl
@NXTangl 17 күн бұрын
@@LeoStaley Probably stable sort.
@ShowMe7.
@ShowMe7. 20 күн бұрын
yay new kuvina video :3
@proton..
@proton.. 20 күн бұрын
as pictures
@Living_Murphys_Law
@Living_Murphys_Law 19 күн бұрын
as pictures
@thermitty_qxr5276
@thermitty_qxr5276 7 күн бұрын
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
@TheBalthassar
@TheBalthassar 19 күн бұрын
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.
@ashes6816
@ashes6816 19 күн бұрын
this is so good
@tobyconner5827
@tobyconner5827 18 күн бұрын
you should do a longer video about joke algorithms (especially more obscure ones like hanoi sort), theyre very fun
@HesterClapp
@HesterClapp 19 күн бұрын
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
@Kettwiesel25 12 күн бұрын
O(n log^2 n) is a smaller time complexity than n^1.2 or even n^1.00001
@not_estains
@not_estains 6 күн бұрын
now explain every shuffling algorithm
@not_estains
@not_estains 16 күн бұрын
radix sort is so cool
@mathguy37
@mathguy37 17 күн бұрын
cool now i can watch this when binging it the 581st time
@AshLikes2analyse
@AshLikes2analyse 19 күн бұрын
You're the best
@andriypredmyrskyy7791
@andriypredmyrskyy7791 18 күн бұрын
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.
@MessyMasyn
@MessyMasyn 16 күн бұрын
Can't wait to get hired at Google/Facebook/Papa Johns
@vincehomoki1612
@vincehomoki1612 16 күн бұрын
1:05:13 Typo! "and building it is O(nlgon)"
@Kuvina
@Kuvina 16 күн бұрын
I'm impressed by how many people have noticed that. But I guess it shows people are really paying attention to the video!
@stefanbergung5514
@stefanbergung5514 15 күн бұрын
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.
@BoBoN4Uto
@BoBoN4Uto 16 күн бұрын
marvel moieverse been real quiet since this dropped
@Vaaaaadim
@Vaaaaadim 18 күн бұрын
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.
@taureon_
@taureon_ 18 күн бұрын
identity crisis sort should randomly start off with quick or merge
@meem2Greene-ju3cs
@meem2Greene-ju3cs 17 күн бұрын
Fireship ahh video lawful evil ending
@WendidIask
@WendidIask 16 күн бұрын
Top sort is not obscure :(. It is used in every DAG problem basically.
@surters
@surters 16 күн бұрын
OMGZ block sort!!!
@BFUS_official
@BFUS_official 18 күн бұрын
I keep hearing login
@hamzamotara4304
@hamzamotara4304 11 күн бұрын
Grade 12 math was not enough for this video XD
@SysFan808
@SysFan808 16 күн бұрын
1:05:16 nlgon
@kvanctok9234
@kvanctok9234 18 күн бұрын
1:05:14 O(nlgon)
@RileyMyers-zz3je
@RileyMyers-zz3je 19 күн бұрын
woohoo!
@lilyyy411
@lilyyy411 18 күн бұрын
among
@VladVideos0
@VladVideos0 14 күн бұрын
Its 117.55 minutes long
@user-jp7zr9gr3n
@user-jp7zr9gr3n 14 күн бұрын
Не души, Владос
@zoeymccann124
@zoeymccann124 16 күн бұрын
Didn't even mention worstsort 0/10
@rodrigoqteixeira
@rodrigoqteixeira 20 күн бұрын
Yooooooooo.
@jan_Eten
@jan_Eten 19 күн бұрын
1:05:14 nlgon xD mi jan lukin nanpa san ale san mute san
@YEWCHENGYINMoe
@YEWCHENGYINMoe 19 күн бұрын
11h ago
@gamergoogol2048
@gamergoogol2048 20 күн бұрын
45th view
@temmie1662
@temmie1662 20 күн бұрын
Helloooo :3
@jan_Eten
@jan_Eten 19 күн бұрын
hoi!
@temmie1662
@temmie1662 19 күн бұрын
@@jan_Eten aaaaa :3
@Spherius
@Spherius 13 күн бұрын
Sigma algorithm: It will say erm what the sigma and then and checks if the array is sorted, if not, it repeats
@vladmarianciuc7574
@vladmarianciuc7574 20 күн бұрын
first :D
@Lev3759Mc
@Lev3759Mc 14 күн бұрын
Confirmed with newest first comments
@qu765
@qu765 19 күн бұрын
gnome sort is my favorite
Visualizing 70 Sorting Algorithms
29:24
Kuvina Saydaki
Рет қаралды 39 М.
And this year's Turing Award goes to...
15:44
polylog
Рет қаралды 86 М.
Когда на улице Маябрь 😈 #марьяна #шортс
00:17
格斗裁判暴力执法!#fighting #shorts
00:15
武林之巅
Рет қаралды 69 МЛН
Be kind🤝
00:22
ISSEI / いっせい
Рет қаралды 11 МЛН
The Bubble Sort Curve
19:18
Lines That Connect
Рет қаралды 384 М.
Explaining EVERY Sorting Algorithm:  Variants and Hybrids
35:12
Kuvina Saydaki
Рет қаралды 23 М.
[TAS] I Wanna Be The Celeste Extremity in 1:53.016
1:28
Ella TAS
Рет қаралды 10 М.
70 is weird
17:05
Kuvina Saydaki
Рет қаралды 82 М.
Why Does Diffusion Work Better than Auto-Regression?
20:18
Algorithmic Simplicity
Рет қаралды 102 М.
Understanding B-Trees: The Data Structure Behind Modern Databases
12:39
15 Sorting Algorithms in 6 Minutes
5:50
Timo Bingmann
Рет қаралды 24 МЛН
How I made my own Fractal
17:33
Kuvina Saydaki
Рет қаралды 76 М.
wyłącznik
0:50
Panele Fotowoltaiczne
Рет қаралды 19 МЛН
Эволюция телефонов!
0:30
ТРЕНДИ ШОРТС
Рет қаралды 6 МЛН
Трагичная История Девушки 😱🔥
0:58
Смотри Под Чаёк
Рет қаралды 361 М.
Дени против умной колонки😁
0:40
Deni & Mani
Рет қаралды 7 МЛН
Готовый миниПК от Intel (но от китайцев)
36:25
Ремонтяш
Рет қаралды 452 М.