Explaining EVERY Sorting Algorithm (part 1)

  Рет қаралды 153,951

Kuvina Saydaki

Kuvina Saydaki

Күн бұрын

There are lots of sorting algorithms and some of them are hard to understand, so in this series I will explain all of them, starting in part 1 with those that I consider most important to understand.
corrections/clarifications: none so far
Chapters:
0:00 Intro
1:04 Selection Sort
1:35 Double Selection Sort
2:01 Insertion Sort
2:38 Binary Insertion Sort
3:27 Bubble Sort
3:59 Shaker Sort
4:21 Asymptotic Notation
7:11 Finding Time Complexity
8:57 Quick Sort
11:22 Merge Sort
12:40 Stability
13:42 Space Complexity
15:28 Heap Sort
18:17 Comb Sort
19:35 Shell Sort
20:59 Radix Sort
24:59 MSD Radix Sort
25:42 Bucket Sort
28:34 Counting Sort
29:52 Spaghetti Sort
30:34 Gravity Sort
32:00 Pancake Sort
33:15 Bogo Sort
34:25 Outro

Пікірлер: 264
@Kuvina
@Kuvina 11 ай бұрын
twitter.com/kuvina_4
@surters
@surters 9 ай бұрын
Hybrid sort - a combination of quick sort, heap sort and insertion sort, see std::sort Timsort - a hybrid of merger sort and insertion sort strings in radex sort.
@limsiewkhim1579
@limsiewkhim1579 8 ай бұрын
But can J do 8t myself ?
@dantebroggi3734
@dantebroggi3734 11 ай бұрын
I propose what I have heard referred to as "Stalin Sort": in O(n) remove any element which would cause the array to be unsorted. Unlike most sorting algorithms it doesn't preserve the contents of an array, but the result is indeed sorted.
@Kuvina
@Kuvina 11 ай бұрын
you've heard of merge sort, now get ready for purge sort
@JiMwB
@JiMwB 9 ай бұрын
​@@Kuvinaneck yeah, it's purging time!
@rosyidharyadi7871
@rosyidharyadi7871 9 ай бұрын
Lol. This sounds like an algorithm created by an AI when you don't specify the requirements explicitly.
@johnvriezen4696
@johnvriezen4696 9 ай бұрын
Order(1) sort: set array size to 0.
@rbpgamemaster
@rbpgamemaster 9 ай бұрын
You know, I wonder, what would happen if, instead of deleting the list forever, you stored the deleted values to another array? Then recursively sorted that purged list, until you're left with a bunch of sublists. Then, simply insert each element in every sublist in the list from the recursion before it, until eventually the list is sorted?
@chair547
@chair547 9 ай бұрын
My favorite sorting algorithm is "don't sort". Its where you figure out a way to solve your problem without sorting the list
@therealelement75
@therealelement75 4 ай бұрын
Redefine Sort: step 1: redefine the sort qualifications so that the list you have is sorted step 2: marvel at your "sorted" list Delete Sort step 1: delete all data step 2: claim that it's all sorted step 3: realize that you could say the same for it being not sorted step 4: panic Replace Sort Step 1: replace the data with the set 1, 2, 3 step 2: profit
@MichaelDarrow-tr1mn
@MichaelDarrow-tr1mn 3 ай бұрын
​@@therealelement75no the empty list is definitely sorted
@How_To_Drive_a_TARDIS
@How_To_Drive_a_TARDIS 9 күн бұрын
Step 1 do step two Step 2 refer back to step number one Or Step 1:Go to step 3 ignore step 2 Step 2:go to step 1 ignore step 3 Step 3:go to step 2 ignore step 1
@KinuTheDragon
@KinuTheDragon 11 ай бұрын
We need to have Quantum Bogosort in the next one; it's too good of a joke algorithm to not include. Great video! :D
@warriorsabe1792
@warriorsabe1792 11 ай бұрын
Yeah it's like "what? you checked them one at a time? Just do every possible permutation simultaneously and grab the sorted one ez"
@KinuTheDragon
@KinuTheDragon 11 ай бұрын
@@warriorsabe1792 Wait, I thought it was "shuffle list, then if not sorted, destroy the universe". Assuming the Many-Worlds interpretation of the universe holds, then all universes where the shuffle did not sort the list will be destroyed, so all surviving universes will have the list sorted in O(n) time and O(1) space complexity.
@henrysaid9470
@henrysaid9470 9 ай бұрын
I watched this expecting it
@maxvangulik1988
@maxvangulik1988 9 ай бұрын
69th like
@steptimusheap8860
@steptimusheap8860 9 ай бұрын
​@@KinuTheDragonin some cases it's O(1). Just don't check if it's sorted, assume it is, and only destroy the universe if there is an error.
@kitsuneprincess4637
@kitsuneprincess4637 11 ай бұрын
I think my favorite sorting algorithm is Miracle Sort. The steps are as follows: Check if the array is sorted. If not, check if the array is sorted. Repeat until sorted.
@kitsuneprincess4637
@kitsuneprincess4637 11 ай бұрын
Also heck yeah, enbies represent! Happy Pride!
@DaemonWorx
@DaemonWorx 9 ай бұрын
Mfw random radiation-induced bit flips
@iyadeltifi3328
@iyadeltifi3328 8 ай бұрын
@@DaemonWorx its best case time complexity is still O(1) because there's always that small chance radiation flips all the bits in perfect order
@DMZZ_DZDM
@DMZZ_DZDM 7 ай бұрын
You'd have to recreate so many SM64 solar bit mutations in order for that to be even a fraction as viable as bogosort
@ckv1985
@ckv1985 20 күн бұрын
​@@DMZZ_DZDMit makes bogobogosort look like the speed of light
@JeffHanke
@JeffHanke 11 ай бұрын
Pattern defeating quicksort. Also if you're looking for "joke" ones: sleepsort. It'd may be interesting to go into algorithms designed with L1/L2 cache and branches/branchless in mind.
@hugmynutus
@hugmynutus 4 ай бұрын
For optimizing cache you'll want to look into "Cache-oblivious algorithms" which is a way of analyzing loads & stores in big O notation (and probabilistic cache misses), the currently most known optimal algorithm for this is Funnelsort (which is a small improvement on Merge sort). Really Quick Sort & Merge Sort are both nearly optimal (which you probably guessed) but at least we have a model to tell us "why" quick sort is so good.
@kath_the_spy
@kath_the_spy 8 ай бұрын
It's like the fourth time I rewatch that series, seriously this is the best resource to intermediary understanding of sorting.
@Rocherz
@Rocherz 8 ай бұрын
In Bogo Sort, instead of permuting the elements randomly, you could just permute the elements sequencially (think of permuting the indexes in lexicographical order, then checking if the reordering sorts the list). It is still O(x!), but at least is guaranteed to sort in finite time.
@11.nguyenhongdien58
@11.nguyenhongdien58 2 ай бұрын
I come here to learn more about the radix sort, but end up watching all of the video. It is very interesting, thank you for making this
@baksoBoy
@baksoBoy 11 ай бұрын
wow this video was super interesting! I somewhat recently programmed an application that sorted tiles in a 2D grid, and coding a fair amount of algorithms made me feel like I at least had a somewhat good grasp of how everything worked, but seeing this video I was really surprised at how deep the subject is, and how much I was missing! Amazing video!
@seriousbusiness2293
@seriousbusiness2293 9 ай бұрын
with all this knowledge i learned that the optimal sorting algorithem for all these animations is simply returning list(range(n)) since after assuming so many wonderful things (n uniform whole numbers between 1 and n) you already know the answer
@jucom756
@jucom756 9 ай бұрын
Binary insertion is actually like one of the if not the best way to sort physical objects, because the reason it is slowed down is shifting is O(n), but with real objects, you can shift everything at once for O(1), like in sorting cards you look for the right spot to put a card and then just stick it in there.
@HesterClapp
@HesterClapp 9 ай бұрын
That was a great explanation of big O notation, which doesn't make it sound illogical!
@cythism8106
@cythism8106 8 ай бұрын
20:08 You really thought you could sneak that in there and have nobody notice
@kat90414
@kat90414 11 ай бұрын
Oh my gosh, I was just getting recommended a bunch of sorting algorithm ASMR(?) videos and was trying to find something to explain each of the sorting algorithms, but none were really helping me. Haven't watched the video yet, but you've done such a good job explaining other complex topics, that I'm pretty sure this one will be of great help to me.
@DissonantSynth
@DissonantSynth 11 ай бұрын
Commenting for the algorithm!
@Stilllife1999
@Stilllife1999 11 ай бұрын
The sorting algorithm
@DigitalJedi
@DigitalJedi 9 ай бұрын
The space/time issue was a huge one for me when I did embedded programming. I used to write code for things as slow as 8mhz 8-bit hardware, with a few kb to a few hundred kb of ram. Merge sort was the usual candidate, but there were actually times that we would say stability be damned and free memory addresses from those twin sorted arrays as soon as they were in the final array, and then just return the final array.
@kodirovsshik
@kodirovsshik 11 ай бұрын
I'm literally playing a programming game right now and I'm thinking which sorting algorithm is the easiest to implement. It could never be a better timing for this video to come out lol. Apart from that, probably good thing to refresh memory and likely learn something new so you are instantly getting a watch time from me 👀
@aformofmatter8913
@aformofmatter8913 8 ай бұрын
If I need to sort something & I don't care about optimization, I use what I call NaïveSort It's selection sort, except instead of swapping elements, you copy the element into a temporary list & delete the original, then at the end you replace the original list with the temporary It's literally just worse than SelectionSort, which is already pretty bad, but it's dead easy to implement -- maybe even the easiest of them all
@kodirovsshik
@kodirovsshik 8 ай бұрын
@@aformofmatter8913 always loved selection sort for how stupidly easy it is to implement, literally just call min and swap in a loop and that's it, but imo yours feels needlessly sophisticated, in a way. Like, for me it is easier to just call swap than to create a new container. Although I see why you like it, it's an interesting approach
@elnico5623
@elnico5623 5 ай бұрын
What game?
@kodirovsshik
@kodirovsshik 5 ай бұрын
@@elnico5623 it was probably "Turing complete". It's not a programming game per se, instead it teaches you to create a computer from logic gates and then you program it. It's available on steam and is very fun, pretty much a sandbox for any digital logic simulation
@AJMansfield1
@AJMansfield1 11 ай бұрын
I look forward to the next part! There's another algorithm I'm not sure is in the end list (since I don't remember the name), but it had to do with a _very particular_ sort of memory device that was able to use chains of charge pump cells to be able to rapidly interleave and shuffle lists together. The algorithm wasn't particularly good asymptotically, but the amount of silicon gate area required for each cell was just _tiny_ and the device could be run at clock speeds fast enough to more than keep up in practical terms.
@foobargorch
@foobargorch 11 ай бұрын
kinda makes me think of what hardware might look like for impractical but asymptotically or even thermodynamically optimal sorting if foregoing solid state
@AlyssaNguyen
@AlyssaNguyen 7 ай бұрын
I couldn't help but think of Liam Neeson… A very particular sort of memory. The sort of memory that's a nightmare for unsorted lists…
@jayare7750
@jayare7750 8 ай бұрын
I put this video knowing it would knock me out, worked like a charm. When I woke up, I re-watched the entire thing because it’s was such an interesting video
@user-bq3kl4hd6w
@user-bq3kl4hd6w 3 ай бұрын
The world needs more KZfaqrs like you and less KZfaqrs of the kind you don't even want to ever find.
@JohnSmith-of2gu
@JohnSmith-of2gu 9 ай бұрын
This is an amazing video, it's like those "sorting algorithms visualized" videos, but with a concise explanation of how each one works. Thank you, it really helped me understand them.
@KazeReload
@KazeReload 7 ай бұрын
Amazing video, really! I was not expecting this high quality, but here it is! You gained a new subscriber.
@daboffey
@daboffey 9 ай бұрын
There are a couple of algorithms used on really old, serial access (i.e. tape) backing store. The first is the Fibonacci sort: Augment the list to make a fibonacci number (say F[n]) of items and split them between two tapes, the first (tape A) containing F[n-1] and the second (tape B) F[n-2] items. Each item on these tapes can be considered a sorted list of length one. Merge sort the first list on tapes A and B onto a third tape (tape C), and repeat for F[n-2] times. Now, rewind tapes B and C. Tape A has F[n-1] - F[n-2] = F[n-3] lists left. This becomes the new tape B. Tape B is finished, so can be used as the new tape C. Tape C has F[n-1] sorted lists, so can be the new Tape A. Repeat this until there is just one sorted list. The other one is an extension of this, called the cascade sort, where, instead of just three tapes, there are k tapes, and tapes 1 to k-1 are merged to tape k, then the tapes are cycled, so tape 1 becomes the new tape 2, tape 2 becomes the new tape 3, …, tape k - 1 becomes the new tape k and the tape k becomes the new tape 1.
@WangleLine
@WangleLine 8 ай бұрын
20:08 I love you for this
@CompilerStuck
@CompilerStuck 7 ай бұрын
Just stumbled upon this and gotta say it's really well made! Keep it up :)
@jftyjghj
@jftyjghj 9 ай бұрын
20:08 AMONGUS
@RiedlerMusics
@RiedlerMusics 9 ай бұрын
in-place merge sort would've been a nice mention. Also the two ways of quicksort partitioning. And in terms of joke sorts, demon sort is one of the more interesting ones :) And then there would be threading optimization with odd-even sort and merge sort… ah, but I haven't seen the second video yet. Great work, anyway!
@tiernanbonnar4212
@tiernanbonnar4212 2 ай бұрын
Fun fact: a quantum bogosort would in theory always resolve in 1 step (if done correctly)
@shieldgenerator7
@shieldgenerator7 7 ай бұрын
30:00 its really cool to see algorithms that only work in the real world! im really glad you included these
@rotar-5078
@rotar-5078 8 ай бұрын
20:09 AMONG US on purple bar
@darqed
@darqed 9 ай бұрын
amazing video you explain everything so well
@darkfirestarfall5694
@darkfirestarfall5694 9 ай бұрын
host is teaching me more math then school ever did, and making it interesting
@simeondermaats
@simeondermaats 9 ай бұрын
brilliant video and your voice is really nice too. will definitely rewatch next year when i have an intro to programming class :)
@amyshaw893
@amyshaw893 9 ай бұрын
Cant wait to see thanos sort. If the array isnt sorted, remove half the items at random. Repeat until the array is sorted
@geochicken9156
@geochicken9156 8 ай бұрын
This is amazing. Thank you
@zyxwv
@zyxwv 8 ай бұрын
I wanted to see how Radix works, and this video explained it so well. I'm only really a beginner at coding, and I had an "OHHHH that makes sense" moment in this
@superduperbjarne
@superduperbjarne 7 ай бұрын
22:42 For best performance you would count the digits without copying the array to the second buffer, after counting you would do the sort copy to the other buffer, then count, sort copy back, and keep going until one of the two arrays has the final sorted result Computational complexity is the same, but it's more performant
@agatitytube
@agatitytube 11 ай бұрын
Wow, this video is a really good work, congratulations!
@Benegade
@Benegade 11 ай бұрын
Loved the visual style
@ethandavis7310
@ethandavis7310 9 ай бұрын
I feel like the statement radix can only sort integers should come with an asterisk. Shouldn't you be able to map any object to an integer and achieve the same results? This would require some preprocessing if it's not baked in to the object itself but could still be done quickly in some cases. For example if you're sorting cities by country->city you could generate an integer encoding for that data to then perform radix on.
@FreyrDev
@FreyrDev 11 ай бұрын
Fluxsort and Quadsort would be pretty interesting to cover as well for the part 2!
@The9gods
@The9gods 8 ай бұрын
Bogo has always been my favorite. Not many sorts can go from "1st try" to "heat death of the universe."
@kazvt
@kazvt 2 ай бұрын
the best video ive seen on this subject
@igNights77
@igNights77 11 ай бұрын
Awesome stuff!
@FreyrDev
@FreyrDev 11 ай бұрын
This is a very good explanation of these sorts! Are you planning to make the code for the visualisations public?
@Kuvina
@Kuvina 10 ай бұрын
I am considering it, but as of right now, the code is a mess with no comments, so I would like to make it readable before that.
@DaemonWorx
@DaemonWorx 9 ай бұрын
No matter how many times I get it explained to me I can’t ever fully understand big O notation. Which is funny because back in the day I was an avid sorting algorithm enjoyer, having made over 90 sorts myself.
@mekafinchi
@mekafinchi 5 ай бұрын
That pancake sort might actually work on some kind of strange doubly-linked list if each link specifies which link of the following element to continue with
@kvanctok9234
@kvanctok9234 9 ай бұрын
20:09 *a m o g u s*
@Kavukamari
@Kavukamari 8 ай бұрын
ive been using bubble sort to maintain the sortedness of arrays, works pretty well if nothing huge needs to change
@TitusRex
@TitusRex 8 ай бұрын
From now on I'll exclusively use BOGO sort for everything.
@alexuty_
@alexuty_ 9 ай бұрын
20:08 among...
@DemirSezer
@DemirSezer 9 ай бұрын
I was dying when I saw that lmao
@dangnguyen8922
@dangnguyen8922 Ай бұрын
This video is really helpful. Keep going bro 🔥🔥
@nicolasturek7563
@nicolasturek7563 9 ай бұрын
I think you don't need merge sort to use the additional array, you can do all in the first one with pointers
@guessundheit6494
@guessundheit6494 9 ай бұрын
This explained sorts in plain language, much better than others have done. Nice flag, too (0:06). 2:35 - A Numberphile video showed that Selection and Insertion are the same sort but reversed. 20:00 - That's not the only way to do Shell Sort. If a pair is swapped at the current gap, compare to the left at the same gap size, repeat until you reach the start of the list. It guarantees that all items at the current gap size will be in order, moving items which might have been missed with a larger gap on previous iterations. Example with gap of three: 4,7,2,9,1,6,5,8,0,3 compare 4 & 9; compare 9 & 5, swap, compare 4 & 5; compare 9 & 3, swap, compare 5 & 3, swap, compare 4 & 3
@natanaelvicenteferreira590
@natanaelvicenteferreira590 9 ай бұрын
Hey! Loved this video :). Small observation I would make is when you're comparing algorithms, maybe use a gradient from green to red to order their complexity :)
@autarchprinceps
@autarchprinceps 5 ай бұрын
In terms of complexity sleep sort is actually weirdly interesting to discuss. Just sleep as long as the number is, and it will print the items likely in order, assuming the minimum difference in sleep is greater than any expectable jitter in the threading handling. While the time complexity is O(n), the efford is actually barely anything. While certainly in the list of impractical sorting algorithms, it is actually implementable at least.
@kristoffersvartbkkengrinda4029
@kristoffersvartbkkengrinda4029 8 ай бұрын
I'm not complaining about the content, because that is ACE, but i'd low cut the vocal track with a EQ or HPF at minimum 85hz. maybe you can even cut it at 120-130hz based on tonal features of your voice, do it post process, not pre. Just a little free tip that will make the sound more consistent through the series. (that is, if you use the same microphone, and the same room ofc) There is a very audible deep humming which i suspect you can just filter away.
@kales901
@kales901 8 ай бұрын
mine: you have list A and B, make list B numbers s-b (smallest number to biggest number in list A), then go through list B and remove any items in list B not in list A, because we made list B s-b, it was sorted, then remove all the ones not in A and we only have the ones in A
@zoltantorok1189
@zoltantorok1189 8 ай бұрын
Here's an interesting variation on the Bogo sort: it will only randomize groups of sorted sequences, then at next check, it will do it again with the new group. Will this be better or worse than regular Bogo? The intuitive answer would be yes, but how would you prove it? My approach would be that there are situation where the list is piecewise sorted and the randomization sorts it right, so it can be a reduction in time complexity, though inconsistent because it only works in one condition but it's also a significant increase in space complexity because you need to keep track of which are the sorted lists.
@KakoriGames
@KakoriGames 9 ай бұрын
When it comes to Bucket sort I'm guessing you can preserve the efficiency of algorithm on non evenly distributed arrays if you know what distribution your data is expected to be, so that you can put more buckets on the densest parts of the array. Also, I wonder if you could do multiple steps of evenly distributed buckets, but only split buckets that are above a certain size. My guess is that it would boil down to another algorithm.
@HarkerFerry
@HarkerFerry 8 ай бұрын
Have you heard about our Lord and savior, Faith Sort? This simple algorithm is sometimes considered a joke, because it starts from the assumption that the list is perfectly sorted when we receive it, and never actively changes the order of the sort while always insisting that the list is properly sorted. If the order of the list happens to change between Faith Sorts, it is still sorted as it always was and always will be. Amen.
@ArcadeMystereo
@ArcadeMystereo 3 күн бұрын
I believe in the sort now. Amen.
@El_Pendejo_De_Si_Mismo
@El_Pendejo_De_Si_Mismo 9 ай бұрын
I'm saving your videos for when it's 3 am and can't sleep
@yellowmarkers
@yellowmarkers 11 ай бұрын
I was just about to cover this topic, but you did it first.
@aungkyawkhant321
@aungkyawkhant321 5 ай бұрын
Amazing video!
@Aubstract
@Aubstract 9 ай бұрын
Yaay, SFML! I used it last semester for some assignments but haven’t ever seen it named in a project someone else has done, so I wondered if it was commonly used or not.
@jonathandufour8621
@jonathandufour8621 10 күн бұрын
What if you use the `median of the medians` algorithm in the implementation of the quicksort to almost always be sure that you will split into 2 equal subsequences? Would it improve its time complexity in the worst case ?
@ansh42069
@ansh42069 8 ай бұрын
my fav sorting is cosmic ray sorting, which basically waits for the cosmic rays to flip the bits and somehow the array will be sorted lol
@Mitsunee_
@Mitsunee_ 9 ай бұрын
I've written a node.js package for sorting in the past and just went back to mess with it again a little and I found out that I wasn't benchmarking node's native sort method for Arrays correctly (it was sorting the input array in-place and then in subsequent runs already had the pre-sorted input). Now I wanna rewrite my package and try double selection sort while I'm at it.
@jimiwills
@jimiwills 9 ай бұрын
Nice. Subscribed ❤
@lightning_11
@lightning_11 8 ай бұрын
Corection at 9:35: Shouldn't the pivot be a random value in the list that we swap to be the first value? That way, we make it less likely that some preoccuring pattern in the data will cause us to get the worst case runtime.
@VoidloniXaarii
@VoidloniXaarii 6 ай бұрын
Very cool thank you so very much
@Hardcore_Remixer
@Hardcore_Remixer 7 ай бұрын
33:40 I had the subs on and it said: "*Bogosaur* is unique because it's not guaranteed to sort the list on finite time." 😂
@jimiwills
@jimiwills 9 ай бұрын
💛🤍💜🖤
@vegtab6556
@vegtab6556 Ай бұрын
Sleep Sort, where you make a thread for each item, let them sleep for that, then they will wake up in order
@ICountFrom0
@ICountFrom0 8 ай бұрын
Radex sort is where it went over my head I think. Could be that 20 minutes of thinking is my limit for one sitting though.
@ToadJimmy
@ToadJimmy Ай бұрын
Great video!
@Kuvina
@Kuvina Ай бұрын
Thank you!
@treelibrarian7618
@treelibrarian7618 9 ай бұрын
in the discussion of radix and related sorts, I fail to see how, in practical implementation, the range can be anything other than O(1), since any practical number representation has a fixed bit count (short of arbitrary precision data types, but who actually uses those). A radix256 sort of a 32bit number can be done in 4 passes, no variance. It doesn't matter if the 32 bit values are int or float, since floats can be turned into a value-ordered sequence of integers by a simple bitwise operation during the first pass, that is easily undone during the last pass (forward: flip all bits of negative numbers and just sign bit of positives). Otherwise a very clear, concise and well presented review of sorting. Thank you. Moving on to ep.2 now...
@djsnowman06
@djsnowman06 7 ай бұрын
Well that escalated quickly
@WUDZ_780
@WUDZ_780 7 ай бұрын
I accidentally subscribed. *+1 sub*
@danielnorred7458
@danielnorred7458 7 ай бұрын
"Words are just 26 bit numbers" God i've never thought about it like that.
@raedev
@raedev 8 ай бұрын
My favourite sorting algorithm is the O(0) (or would it be O(1)?) Ba Sing Sort, aka "there is no out of place value in the array". You don't do anything, and the array is already sorted. Trust me.
@smoceany9478
@smoceany9478 8 ай бұрын
new idea, scan the list, consider that the way its supposed to be sorted, boom
@DendrummerMC
@DendrummerMC 9 ай бұрын
A little while back I saw a video on BOGO BOGOsort (if I recall the name correctly). Iirc it's some kind of bogosort nested in another bogosort, but I forgot the details
@simonwillover4175
@simonwillover4175 9 ай бұрын
How is merge sort n space complexity? I can make a program that does it without using extra memory!
@foobargorch
@foobargorch 11 ай бұрын
one thing possibly missing from the obscure sorts list is examples program synthesis and machine learning producing novel algorithms which are not easily explained
@codenamelambda
@codenamelambda 7 ай бұрын
I assume the thumbnail is probably heapsort? I am kind of curious. Even though it really doesn't matter LOL
@erikhaag4250
@erikhaag4250 8 ай бұрын
in languages with pointers, you can make a list where each element has a pointer to the next element. using this structure, you can shift the entire array by using the pointers and not repeated reading and writing.
@andredasilva9458
@andredasilva9458 8 ай бұрын
isn't pointer arithmetic like a taboo?
@i_like_treins3449
@i_like_treins3449 Ай бұрын
Nuclear Bomb Sort: sets EVERY element in the array to 0 and checks if it's sorted
@A_literal_cube
@A_literal_cube 27 күн бұрын
This, is technically O(n) time, and actually has a space complexity of, 0 But it is less useful than stalin sort
@FreeThinkingWisdom
@FreeThinkingWisdom 3 ай бұрын
I like the vid! something you may want to clarify about binary search insert is that in theory it's faster in practice it's not. The check is O(nlog(n)) but the act of inserting it in the location and shifting makes it O(n^2) still. So it's actually not better.
@CommunistRainbowdash
@CommunistRainbowdash 8 ай бұрын
20:09 I see you
@kaiperdaens7670
@kaiperdaens7670 8 ай бұрын
Pls do BOGO BOGOsort
@Kuvina
@Kuvina 8 ай бұрын
It's in part 3 which I just uploaded yesterday!
@kaiperdaens7670
@kaiperdaens7670 8 ай бұрын
@@Kuvina ok thnx for the info I am watching part 2 rn and next I will watch part 3, btw this was exactly the type of vid I was searching so thnx for that
@WYATTsJUEGOS
@WYATTsJUEGOS Ай бұрын
Thanks!
@Kuvina
@Kuvina Ай бұрын
Thank you!
@mathguy37
@mathguy37 8 ай бұрын
Me when seeing gravity sort somehow have everything go into place (particularly on a circular visualization): oh so that makes everything fall to its correct place “Gravity sort *insert stuff blah blah blah it uses gravity ok*” Me: oh it literally does that
@shieldgenerator7
@shieldgenerator7 7 ай бұрын
13:43 actually, selection sort can be stable, depending on how you find the smallest/largest number, and how you implement the algorithm
@nacaobrasil
@nacaobrasil 4 ай бұрын
Chuck Norris sort: it is sorted
@gdmathguy
@gdmathguy 9 ай бұрын
Is a sorting algorhythm possible where the average time is so bad it's a function like Grahams function, TREE or SCG?
@ethandavis7310
@ethandavis7310 9 ай бұрын
If your only definition of a sorting alg is that it takes a sortable array as input and returns a sorted array, then yes. You can write an algorithm that performs bogosort (time complexity n*n! average) but also on each step j compute tree(j). This will do nothing to the array but will add computation that scales with the tree function. The final complexity will run O(TREE(n*n!)) average case with O(n) best case and an undefined worst case because bogosort has the ability to run infinitely. I'm pretty sure any algorithm that computes the tree sequence is indeed O(TREE(n)) but I'm not positive.
@Rockys-Studio
@Rockys-Studio 6 ай бұрын
the start kinda looks like a musical of the europe continent in fl studio if you remember
@PenguinGeek1
@PenguinGeek1 8 ай бұрын
I don't know if I'm stealing an idea but couldn't you work from left to right, if a piece is smaller then the one on the left of it, put it at the start. I don't know if I'm wording one you talked about differently, if you mentioned it and I forgot or if I made it up and it's no good
@FerrybigGaming
@FerrybigGaming 3 ай бұрын
One interesting algorithm is gnone sort, it is really great for space complexity
Every Sorting Algorithm (part 2): The Weird and Obscure
18:27
Kuvina Saydaki
Рет қаралды 32 М.
Every Sorting Algorithm Explained in 120 minutes (full series)
1:57:33
Kuvina Saydaki
Рет қаралды 25 М.
How did CatNap end up in Luca cartoon?🙀
00:16
LOL
Рет қаралды 7 МЛН
Don't eat centipede 🪱😂
00:19
Nadir Sailov
Рет қаралды 21 МЛН
Kotlin Multiplatform vs Flutter: Which should we use?
4:42
Kei Fujikawa
Рет қаралды 17
Running "Hello World!" in 10 FORBIDDEN Programming Languages
18:07
The Bubble Sort Curve
19:18
Lines That Connect
Рет қаралды 359 М.
The Boundary of Computation
12:59
Mutual Information
Рет қаралды 914 М.
sorting algorithms to relax/study to
58:05
Musicombo
Рет қаралды 2,6 МЛН
10 weird algorithms
9:06
Fireship
Рет қаралды 1 МЛН
How Dijkstra's Algorithm Works
8:31
Spanning Tree
Рет қаралды 1,2 МЛН
10 FORBIDDEN Sorting Algorithms
9:41
Ardens
Рет қаралды 769 М.
15 Sorting Algorithms in 6 Minutes
5:50
Timo Bingmann
Рет қаралды 24 МЛН
Vortex Cannon vs Drone
20:44
Mark Rober
Рет қаралды 14 МЛН
phone charge game #viral #tranding #new #reels
0:18
YODHA GAMING RAAS
Рет қаралды 12 МЛН
Эффект Карбонаро и бумажный телефон
1:01
История одного вокалиста
Рет қаралды 2,3 МЛН