Why is Radix Sort so Fast? Part 1 Why are Comparison Sorts so Slow?

Support What's a Creel? on Patreon: / whatsacreel
Office merch store: whats-a-creel-3.creator-sprin...
FaceBook: / whatsacreel
In this 3 part series, we will explore sorting algorithms from the fundamentals all the up to implementations of both a comparison sort and a base 256 Radix Sort.
In this first video, we explore why Comparison Sorts have a speed limit: O(nLogn).
Software used to make this vid:
Visual Studio 2019 Community: www.visualstudio.com/downloads/
Blender: www.blender.org/
OBS: obsproject.com/
Davinci Resolve 16: www.blackmagicdesign.com/prod...
OpenOffice: www.openoffice.org/
Gimp: www.gimp.org/
80's 3D neon effect in the thumbnail is from Ducky 3D's: • Blender - 80's Style A...
Background HDRI from thumbnail and intro is from HDRI Haven: hdrihaven.com/

Пікірлер: 296

  • 3 жыл бұрын

    You forgot about Stalin sort witch is O(n). You simply go through the array of elements and eliminate ones which are not in order. In the end you end up with sorted array.

  • @jctalbott2007

    @jctalbott2007

    3 жыл бұрын

    Is this a known CS joke? because it's hilarious

  • @MatheusAugustoGames

    @MatheusAugustoGames

    3 жыл бұрын

    Or Hope Sort. You return the original array, hoping it was already sorted.

  • @Adomas_B

    @Adomas_B

    3 жыл бұрын

    But on average your time is n!/2

  • @NoahtheEpicGuy

    @NoahtheEpicGuy

    3 жыл бұрын

    @@MatheusAugustoGames Why not Index Sort? You just sort by the index in the array, and, wow! It's already sorted! It's like Hope Sort but with extra steps!

  • @dm121984

    @dm121984

    3 жыл бұрын

    You also have to destroy all evidence of the 'removed' elements

  • @carlphilippgaebler5704
    @carlphilippgaebler57042 жыл бұрын

    1:10 This is the fastest sorting algorithm I've seen! EyeballSort is O(n) with NO overhead!

  • @esra_erimez
    @esra_erimez3 жыл бұрын

    I wish this was available when I was taking comp sci in college

  • @WhatsACreel

    @WhatsACreel

    3 жыл бұрын

    Thank you, cheers for watching :)

  • @benjaminweeg9684

    @benjaminweeg9684

    3 жыл бұрын

    Just found this! I'm still in Computer Science right now! 😁

  • @samarths
    @samarths3 жыл бұрын

    This look at sorting is just brilliant. Thanks for making this video. Eagerly waiting for part 2.

  • @WhatsACreel

    @WhatsACreel

    3 жыл бұрын

    That great mate! Hopefully I can upload later today. Thank you for watching :)

  • @_wouter52
    @_wouter523 жыл бұрын

    I love your enthusiasm! I found your channel a view days ago through a video explaining branchless programming. I was hooked 😀 you gained yourself a longterm subscriber 😎😃

  • @WhatsACreel

    @WhatsACreel

    3 жыл бұрын

    That's great, welcome mate! Thank you for watching :)

  • @asrew1337
    @asrew13373 жыл бұрын

    I'm glad I know this 2 years before actually taking comp sci, let's see if I forget by then and come back

  • @kyrilcouda

    @kyrilcouda

    3 жыл бұрын

    I will take a bet and say that you will comment here in few years. I would like you to tag me when that happens, pls :D

  • @excitedbox5705

    @excitedbox5705

    3 жыл бұрын

    Start now. You will be ahead by the time you get there and have lots of free time. I always did weeks of work in 1 day and played games the rest of my time.

  • @aBigBadWolf
    @aBigBadWolf3 жыл бұрын

    This is actually a really refreshing and nice view on sorting algorithms! I know about sorting but you brought something new to the table. Subscribed!

  • @JPADavies
    @JPADavies2 жыл бұрын

    Dude - I have just finished binge-watching about 20 of your videos back to back, and just wanted to drop you a line to say how fantastic your content is, and to wish you and your family a fantastic Crimbo. I don't know if you have a background in teaching (and I'm too lazy to check), and I'm sure you've heard this a million times before, but you if you haven't already, you should totally consider a career in this. It's impossible to watch your vids without a smile on my face. After today's session, and thanks to your tutes, I've found that Radix sort has reawakened the CompSci beast within me (don't tell the missus). Have a good one mate, and thanks again for everything you're putting out there. Massive appreciation.

  • @oresteszoupanos
    @oresteszoupanos3 жыл бұрын

    Talk about a cliffhanger... How can you go faster than N log(N)?! Brilliant walkthrough, look forward to parts 2 and 3!

  • @djordjepepic1656
    @djordjepepic16563 жыл бұрын

    Ever since your sorting race video I was so curious about radix sort! What an awesome video great work :D Edit: Can't wait for the next video!

  • @WhatsACreel

    @WhatsACreel

    3 жыл бұрын

    Radix Sort is an amazing algorithm! Hopefully I can upload later today. Thank you for watching :)

  • @mojomanxero8632
    @mojomanxero86323 жыл бұрын

    I'm basically just going to watch all your videos to prepare me until I get a real job since I graduated university. Love your work and thank you for the clear and concise explanation of everything you do!!!

  • @ricardomahfoud
    @ricardomahfoud3 жыл бұрын

    I love your explanations, I love your attitude, and I love the good energy. I actually watched the radix series in reverse order (oops) but still enjoyed it and found alot of good information non the less. I'm in my last semester as a Computer Science Student, and I can tell you they never teach us like this in college. I had to get my information and skills from watching guys like you explain it, instead of listening to a professor saying "Sorting cannot be done in less than O(nlogn), write that down and memorize it". Again, I hope you keep it up and have a great day!

  • @unfa00
    @unfa002 жыл бұрын

    You managed to present this topic in an interesting (even exciting!) way and brought me a deeper understanding of what sorting is about. Thank you!

  • @0xCAFEF00D
    @0xCAFEF00D3 жыл бұрын

    This is exactly how I'd like to have been taught comparison sorts.

  • @yachint1570
    @yachint15702 жыл бұрын

    Your videos on each topic are highly detailed yet very easy to understand. I just found out about your channel and love watching the explanations. I hope you will keep making more! :)

  • @mehdioueslati8713
    @mehdioueslati87133 жыл бұрын

    I've never thought of sorting algorithms that way! Thanks a lot of this new insight, and I sure can't wait for the next parts!

  • @WhatsACreel

    @WhatsACreel

    3 жыл бұрын

    Glad you liked it! Thank you for watching :)

  • @soyitiel
    @soyitiel3 жыл бұрын

    At first I read the title as "why is radix sort of fast?"

  • @notsojharedtroll23

    @notsojharedtroll23

    3 жыл бұрын

    Close enough, isn't it?

  • @MusavirKhaliq
    @MusavirKhaliq3 жыл бұрын

    just wow!!! even i knew this concept but i learned it the hardway back 2 days ago and now i found your video.... sorry u are underrated

  • @ferinzz
    @ferinzz3 жыл бұрын

    Always important to cover the basis to understand why something is as good as it is. Again, thank you. (Just had to go through all these and upvote them all. Don't want YT recommending pt3 before pt 1 :D )

  • @MrHandsy
    @MrHandsy3 жыл бұрын

    Your enthusiasm is infectious

  • @billowen3285
    @billowen32853 жыл бұрын

    Oh now i finally understand why logn appeared all the time! Fantastic video

  • @WhatsACreel

    @WhatsACreel

    3 жыл бұрын

    That's really great! Thanks for watching :)

  • @Ferdam
    @Ferdam3 жыл бұрын

    That's very nice. I'm looking forward to next videos about this!

  • @WhatsACreel

    @WhatsACreel

    3 жыл бұрын

    Hopefully I can upload later today! Thanks for watching mate :)

  • @nikilragav
    @nikilragav3 жыл бұрын

    Eagerly waiting for part 2! Never really thought about turning sorting into a tree

  • @Quarky_
    @Quarky_3 жыл бұрын

    Beautiful explanation and visualisation! I always get confused by big-O, but I think I'll remember this one for a long long time :)

  • @saneyarkhazin7671
    @saneyarkhazin76713 жыл бұрын

    Mind blowing explanation! Can't wait for part 2!

  • @WhatsACreel

    @WhatsACreel

    3 жыл бұрын

    Great to hear mate! All 3 vids are up now! Cheers for watching :)

  • @temdisponivel
    @temdisponivel3 жыл бұрын

    Really insightful video once again mate. Keep it up!

  • @WhatsACreel

    @WhatsACreel

    3 жыл бұрын

    Cheers mate, thank you for watching :)

  • @coder2k
    @coder2k3 жыл бұрын

    Great explanations so far! Looking forward to seeing the next part! :)

  • @WhatsACreel

    @WhatsACreel

    3 жыл бұрын

    That's great! Hopefully I can upload later today. Thank you for watching :)

  • @Otomega1

    @Otomega1

    3 жыл бұрын

    @@WhatsACreel perfect👍

  • @dirtywhitellama
    @dirtywhitellama3 жыл бұрын

    Fantastic video, helps give another perspective to look at comparison sorts, very useful!

  • @Taterzz
    @Taterzz2 жыл бұрын

    just going to appreciate the choice for green. i'm color blind and you cannot believe how often people use that super light green that's indistinguishable from yellow for me.

  • @nickscurvy8635
    @nickscurvy86352 жыл бұрын

    The explanation for why number of permutations is a factorial was so simple and so intuitive that it finally clicked for me WHY that is. Previously I knew that was the case and sorta took it as granted without actually getting it. I just sorta memorized it and accepted it as the way things were My mind has been blown. Thanks for blowing it for me.

  • @Mackinstyle
    @Mackinstyle2 жыл бұрын

    The amount of background you provide is pitch perfect, for me, at least. Thank you.

  • @FlightDeckRyan
    @FlightDeckRyan3 жыл бұрын

    Don't know the first thing about compsci but this is a very good video, thank you for making this, man

  • @HaouasLeDocteur
    @HaouasLeDocteur3 жыл бұрын

    This is really really really well explained

  • @phuctran25277
    @phuctran252773 жыл бұрын

    For anyone who is wondering how he get log(N!) to N*log(N). I figured it out. N! is (N)*(N-1)*(N-2)*(N-3)...*1. The last step can be written as (N-N+1) . N*(N-1) is close to N^2 so we approximatd that. As an approximation to compute N! means to multiply N , N times. Which can be written as N^N. So log(N!) => log(N^N) because of log property we can get N out making it N*log(N).

  • @andrewjhaman
    @andrewjhaman3 жыл бұрын

    Fantastic as always

  • @WhatsACreel

    @WhatsACreel

    3 жыл бұрын

    Thank you! Cheers for watching :)

  • @CrystlizeWorld
    @CrystlizeWorld3 жыл бұрын

    Mate, love your explanation!

  • @75hilmar
    @75hilmar2 жыл бұрын

    Wow thanks, I am dabbling with permutations of unique elements of tree names for weeks and I watched this only now?!? Radix Sort popped up in recommended for a week ago. I thought your thumbnail was just too promising to be true 😂

  • @ricos1497
    @ricos14973 жыл бұрын

    Really interesting video. Not sure how I managed to subscribe to your channel, but I'm glad I did. Although I already knew that a creel was a basket for catching lobster.

  • @WhatsACreel

    @WhatsACreel

    3 жыл бұрын

    Ha! Glad you came back mate! I will be certain to employ a creel when I next find a lobster :)

  • @I_am_Alan
    @I_am_Alan3 жыл бұрын

    Excellent graphics! Perfect pace!

  • @WhatsACreel

    @WhatsACreel

    3 жыл бұрын

    Cheers mate, thanks for watching :)

  • @DiscomongoEGE
    @DiscomongoEGE2 жыл бұрын

    that was an amazing explanation

  • @YilmazDurmaz
    @YilmazDurmaz2 жыл бұрын

    time well spent! now I understand better what O(NlogN) means.

  • @Otomega1
    @Otomega13 жыл бұрын

    Please send part 2 😭 great video

  • @MauroScomparin
    @MauroScomparin3 жыл бұрын

    Pretty cool explanation of nlogn

  • @EvilSapphireR
    @EvilSapphireR3 жыл бұрын

    I think you finally made sorting interesting for me. Would've loved a detailed discussion on why the time complexity of the comparison sort is log2(n!) though.

  • @marcvanleeuwen5986

    @marcvanleeuwen5986

    2 жыл бұрын

    The time complexity of the comparison sort is not log_2(n!) because there is no such thing as "the" comparison sort. Comparison sorting is a class of sorting techniques (which includes very different methods like selection sort and merge sort), and not all have the same complexity. But none can do better (in the worst case, or even on average) than log_2(n!) , for the reason explained in the video (each comparison can at best guarantee halving the number of remaining viable permutations).

  • @georhodiumgeo9827
    @georhodiumgeo98273 жыл бұрын

    I love the shirt! Oh yeah, as always the content was also good.

  • @s0lly
    @s0lly3 жыл бұрын

    Awesome video bud

  • @WhatsACreel

    @WhatsACreel

    3 жыл бұрын

    That's good! Thank you for watching mate :)

  • @shirosurfer8864
    @shirosurfer88643 жыл бұрын

    This is the kind of thinking that I like to do on my own but I'm always partially stuck in begging or end because I'm missing one critical point thinking about the identity of the method and the standard objective of what is that I want to measure in any given point of the figuring out part or the sorting process really good video man

  • @steffennilsen2132
    @steffennilsen21323 жыл бұрын

    Great visualization

  • @shirosurfer8864
    @shirosurfer88643 жыл бұрын

    This is brilliant you are brilliant

  • @stephenhowe4107
    @stephenhowe41072 жыл бұрын

    If the distribution is random, then yes O(N * log N) is the best you can do for comparison based sorts. But if the distribution is not random, and the algorithm notices, it can take advantage of that and do less sorting. It will be O(N). And example of that is natural merge sort where the sort takes advantage of any natural runs (or reverse runs, and reverse that).

  • @Shivam-kz2dg

    @Shivam-kz2dg

    10 ай бұрын

    Does CPU use counting sort for small data ?

  • @Axelvad
    @Axelvad3 жыл бұрын

    Nice video, but you should consider using audio absorbers cause the reverberation is quite massive

  • @_iphoenix_6164
    @_iphoenix_61643 жыл бұрын

    I hadn't even though of it this way, this is super duper cool- well done!

  • @mihirpatil8843

    @mihirpatil8843

    3 жыл бұрын

    Hello Phoenix

  • @asimikrop
    @asimikrop2 жыл бұрын

    Brilliant!

  • @user-pw5do6tu7i
    @user-pw5do6tu7i3 жыл бұрын

    This guy is amazing.

  • @user-wh6cd6ef1w
    @user-wh6cd6ef1w3 жыл бұрын

    thx youtube algorithm recommend this awesome video

  • @tytuer
    @tytuer3 жыл бұрын

    Great video. Now, I have a question. Since, sorted array is one of the permutations, I wonder is there any sorting algorithm using symmetric groups and group theory?

  • @WhatsACreel

    @WhatsACreel

    3 жыл бұрын

    That’s a really interesting question! I am not aware of any algorithms that explicitly use them, but I think they explain the basis of how sorting algorithms work. Maybe theoretically all sorting algorithms use them? Cheers for this question mate, and cheers for watching :)

  • @larryd9577
    @larryd95773 жыл бұрын

    You could have just covered the whole stability topic in one sentence. And maybe one phrase for why it is useful. "Sorting is said to be stable: WLOG if index of 436[green] "It's a useful property for example if you want to use said sorting algorithm on the same set of numbers multiple times, e.g. sort a sequence by digits, starting at the highest significant digit. 42, 18, 12 => 18, 12, 42 => 12, 18, 42"

  • @kimjanek646
    @kimjanek6463 жыл бұрын

    Great Video :)

  • @naturallyinterested7569
    @naturallyinterested75693 жыл бұрын

    Hey, great video! I have been meaning to ask you what you think of RISC V, considering its lack of conditional moves and its vector extensions?

  • @WhatsACreel

    @WhatsACreel

    3 жыл бұрын

    I haven’t played around with a risc v processor yet. I like the newer SIMD proposal more than the old one, where they were going to use the regular registers for SIMD. It seems to have some really great ideas! Not sure when or if the vector extensions will be part of the standard, but I think it all looks really interesting! Great question! Hopefully at some point we can explore other Assembly languagues on this channel. I’d love to cover Atmel, PIC and ARM at some point. Well, thank you for watching :)

  • @naturallyinterested7569

    @naturallyinterested7569

    3 жыл бұрын

    @@WhatsACreel Thanks!

  • @NoNameAtAll2

    @NoNameAtAll2

    2 жыл бұрын

    B[it operations] expansion will have cmovs, I think

  • @ValdaXD
    @ValdaXD3 жыл бұрын

    Oh this is a great channel.

  • @ValdaXD

    @ValdaXD

    3 жыл бұрын

    Unless... maybe....

  • @qschroed
    @qschroed3 жыл бұрын

    I hope this isn't too dumb a question but I was wondering about the use of big O in the video. Shouldn't it be big_Omega(nlogn) instead O(nlogn) since the nlogn is a lower bound for the complexity?

  • @karis7539
    @karis75392 жыл бұрын

    you make those depressing themes so fun

  • @uncoherentramblings2826
    @uncoherentramblings28263 жыл бұрын

    Simply, YES!

  • @WhatsACreel

    @WhatsACreel

    3 жыл бұрын

    Thank you Sir Universe :)

  • @davidkaye821
    @davidkaye8213 жыл бұрын

    Hello! Great videos! Please tell me, what is the picture behind you on the right (your left) the one with the red border? At first I thought MC Escher, but screen capping and blowing up, doesn't look like it.

  • @WhatsACreel

    @WhatsACreel

    3 жыл бұрын

    My father drew both the pictures in the background. The left one is a koala playing cricket, and the right one is a man waiting at a train station. Dad is easily the most talented artist I have ever met - he produces photo realism with nothing but Faber Castell 6B pencils!! I will never know how he does it. He says it’s just patience, and off he goes drawing like that! hahaha Amazing man :) Maybe I will include a closeup of these images in a video at some point? They are extraordinary! Cheers for watching :)

  • @davidkaye821

    @davidkaye821

    3 жыл бұрын

    @@WhatsACreel PLEASE do include those, and give your father my best! Your sorting algorithm videos made me REALLY understand how important computer SCIENCE is in our world!

  • @1Maklak
    @1Maklak3 жыл бұрын

    I was taught that n*log(n) was from recursively dividing the array in half, sorting the halves and merging, which needs a depth of log(n) multiplied by a linear time to merge sorted arrays, but this permutation approach is far more elegant.

  • @clefablelover7801

    @clefablelover7801

    2 жыл бұрын

    That's a merge sort, different approach, same time complexity.

  • @1Maklak

    @1Maklak

    2 жыл бұрын

    @@clefablelover7801 Quicksort is also roughly dividing the array in half and sorting the halves, just without merging. So the same logic applies to it.

  • @Lucas72928
    @Lucas729282 жыл бұрын

    Where did that log2(n!) come from?

  • @ChipUeltschey
    @ChipUeltschey3 жыл бұрын

    This is fabulous! How would you explain the conversion of number of comparisons, i.e. Log2(N!), to O(NLogN)? This must be obvious to folks more familiar with Big O notation...which is not me.

  • @ralphmb980

    @ralphmb980

    2 жыл бұрын

    Bit late maybe, but there's a thing called stirling's formula which states n! ~= sqrt(2pi n) (n/2.7)^n, which is roughly on the same order as n^n. so log(n!) ~= log(n^n) = nlogn

  • @ChipUeltschey

    @ChipUeltschey

    2 жыл бұрын

    @@ralphmb980 thank you!

  • @JTheoryScience
    @JTheoryScience3 жыл бұрын

    i think your audio is a bit weird maybe? either your mic is set to omni-directional or your room is made of glass, brick and tiles.. perhaps some acoustic foam would help, and a reverb adjustment? great video regardless. nice job mate.

  • @wardenstein
    @wardenstein3 жыл бұрын

    15:00 earned my sub

  • @DSCuber
    @DSCuber3 жыл бұрын

    Why would it be NLogN and not logN? Unless I'm missing something, I don't see how you do N comparisons logN times.

  • @slayemin
    @slayemin3 жыл бұрын

    What is the fastest way to check whether a list of elements is sorted? Would it still be O(NLogN)?

  • @WhatsACreel

    @WhatsACreel

    3 жыл бұрын

    I think you'd go through the list and check if every number is greater than the previous one. I don't think there is any faster way than that, so I guess it's O(n)? Cheers for watching mate :)

  • @AlessioSangalli
    @AlessioSangalli3 жыл бұрын

    Very good video but how bad is the sound? I strongly suggest you put some absorbing material on the walls and keep that mike a little closer (or get a dynamic one that might be better suited for your studio)

  • @WhatsACreel

    @WhatsACreel

    3 жыл бұрын

    Yep, I messed up the audio in some of these! There was a couple of vids where I lost the audio from the mic all together and had to use the camera mic! The audio is improving bit by bit. Thanks for the suggestions, and thanks for watching :)

  • @AlessioSangalli

    @AlessioSangalli

    3 жыл бұрын

    @@WhatsACreel cool, I know a bit about audio because my son wants to be a KZreadr and the single best thing we did to improve his videos was to take care of the sound. If you used the camera mike it explains why the sound is so terrible 😭 And yes, your videos are otherwise VERY good 😊😊

  • @Thermisto_
    @Thermisto_3 жыл бұрын

    I don’t even study computer science.. What is Radix.. and yet here I am learning about sorting algorithms

  • @thomaskember4628
    @thomaskember46283 жыл бұрын

    I was taught that the Bubble Sort was easiest sort to understand but the lest efficient . However, there was no question that it produced correctly sorted result. Surely any sort will work no matter how slow it is and how much RAM it uses. Later I learned the Quick Sort. It as the name implies is pretty good and also, using recursion, is easy to code.

  • @Neran280

    @Neran280

    2 жыл бұрын

    In my opinion bubble sort should not be used as a sorting algorithm for teaching purposes. I do understand that as an introduction intuitive algorithms are discussed first. But I think that bubble sort is not intuitive at all (and also has no application). I mean ever sorted a deck of cards with bubble sort?

  • @TheMR-777
    @TheMR-7773 жыл бұрын

    *Edit : Confusion Solved by "Luca". Explained by "Some One"* At 13:32 , it was said that paths can be an odd number. But I think they can't be. Because mathematically, we are taking factorial ( ! ), and the result of factorial can never be an Odd number. Simple to say, we always divide a number with "2" at the end. Please consider it, and tell me if I'm wrong

  • @Lucaazade

    @Lucaazade

    3 жыл бұрын

    11:17

  • @oliwiermoskalewicz1988

    @oliwiermoskalewicz1988

    3 жыл бұрын

    At the beginning there is an even number of paths. But since there are only few ns such that n! = 2^k there is always a point where the number of left paths is odd.

  • @TheMR-777

    @TheMR-777

    3 жыл бұрын

    @@Lucaazade Oh okay, I thought that was about the "Total paths". Thanks for the correction.

  • @TheMR-777

    @TheMR-777

    3 жыл бұрын

    @@oliwiermoskalewicz1988 Oh okay, Got the point. Thank you so much. I was considering the whole paths (total paths)

  • @powerpc6037
    @powerpc60373 жыл бұрын

    To sort your 4 elements, all you did was ask 5 questions, so it looks to me you only need n+1 iterations/checks/comparisons. What about swapping numbers which are in reverse order until the last iteration doesn't have anything to swap anymore? If you are lucky and the list only needs 1 swap, that kind of sort is quite fast and is also a comparison sort. Just check if value 1 is larger than value 2. If so, swap number 1 and 2. If it's not, do nothing. Then move on to number 2 and 3, then 3 and 4. Don't forget to record the amount of swaps you do when running through the list. Then start again from the first number and compare it again against number 2 and so on. If the amount of swaps is still 0 at the end of the list, it's sorted. For a small list of any data, be it numbers or text, I find it fast enough to use even for a realtime game like sorting the inventory of a MMORPG.

  • @Adomas_B
    @Adomas_B3 жыл бұрын

    But how do you know algorhitmically which branches to cut off?

  • @proweiqi
    @proweiqi3 жыл бұрын

    really glad that radix is getting some attention

  • @WhatsACreel

    @WhatsACreel

    3 жыл бұрын

    Amazing algorithm!! Cheers for watching mate :)

  • @proweiqi

    @proweiqi

    3 жыл бұрын

    @@WhatsACreel No worries. Great content! Could do with a better mic or mic settings though. I gave a talk about radix sort myself kzread.info/dash/bejne/dWpp2LuQlbGdXc4.html

  • @WhatsACreel

    @WhatsACreel

    3 жыл бұрын

    Great talk, looks like a very interesting use case! You nailed it :) I’ve already recorded the 3 vids for this mini-series, but I will look into improving my microphone technique for the future. Thank you for the advice :)

  • @cloudsquall88
    @cloudsquall883 жыл бұрын

    I don't understand how we went from log2(N!) to Nlog(N). Could someone please explain to me?

  • @saulaxel

    @saulaxel

    3 жыл бұрын

    Big O designates an expression that is above the exact time complexity in the long term, but not necessarily the closest expression. If something is O(n), it is also O(n^2), but the smallest one is usually the most significant. Well, something like O(log2(N!)) is tecnically O(Log2(N^N)) since the later is bigger, but in this case we can extract a N to get the complexity in the video.

  • @Templarfreak
    @Templarfreak3 жыл бұрын

    13:31 With the exceptions of 0 and 1, all factorials are actually even! So you actually should never have an odd number of paths (except in the cases of 0 or 1, where you'll know your list is technically already sorted anyway).

  • @macdjord

    @macdjord

    3 жыл бұрын

    That only guarantees that the *first* operation is even. Every factorial greater than 2! will have at least one odd prime factor, so you'll always have *some* uneven splits.

  • @kruxigt
    @kruxigt3 жыл бұрын

    Can't wait!

  • @FinaISpartan
    @FinaISpartan3 жыл бұрын

    I feel like you should've covered "nearly sorted lists" in your sort olympics. In many cases, we have to sort after each data insertion and this metric is the most important.

  • @WhatsACreel

    @WhatsACreel

    3 жыл бұрын

    That's a really good topic! Cheers for the suggestion! And thank you for watching :)

  • @Joel-co3xl

    @Joel-co3xl

    3 жыл бұрын

    Just use insertion sort for that case, it's nearly linear for mostly sorted lists.

  • @myselfremade
    @myselfremade3 жыл бұрын

    Praise the KZread algorithm! I just accidentally discovered your channel and I haven't even watched the video but already I like it. BUT IT THE MIC CLOSER TO YOUR MOUTH FOR GOD'S SAKE MAN. BAD AUDIO IS #2 CAUSE FOR KZread CHANNEL FAILURES

  • @WhatsACreel

    @WhatsACreel

    3 жыл бұрын

    My mic technique needs some work, sure. So does my sound engineering, ha! :( This video gets comments about sound quality and the others in the series do not. The sound was recorded the same, so I'd love to know what the exact problem is. There was a bunch of suggestions when I first uploaded, and I figured it was all the recording setup. But the more negative feedback this first video gets, and the lack of that same feedback on the others make me wonder if actually the recording was fine and I did something when I EQ'd the audio? Anyways, cheers for letting me know about the sound quality. I don't doubt that moving the mic closer will help, and I will certainly try to address these issues in upcoming videos. Cheers for watching too :)

  • @myselfremade

    @myselfremade

    3 жыл бұрын

    @@WhatsACreel Those microphones are made to be about 2-4 inches directly in front of your mouth, like a radio brodcaster. I just watched a bunch of your assembly videos too. Very high quality stuff. (and the audio is better in those lol)

  • @WhatsACreel

    @WhatsACreel

    3 жыл бұрын

    @@myselfremade Thank you mate! I'll take this advice on board :)

  • @myselfremade

    @myselfremade

    3 жыл бұрын

    @@WhatsACreel :) also make sure you look up which side of that specific microphone is supposed to face towards you. Sometimes the answer is unexpected

  • @The__Leo69
    @The__Leo692 жыл бұрын

    Best part about radix sort is that it can be easily adapted for processing strings.

  • @RagHelen
    @RagHelen3 жыл бұрын

    9:00 I don't understand the rules of that game. How can you make any assertion on the basis of what is on the display? Why would red < green == False?

  • @phuctran25277

    @phuctran25277

    3 жыл бұрын

    He meant only looking up their values (ONLY their values and not the rest) when you do a comparison

  • @markmanning2921
    @markmanning29213 жыл бұрын

    technically is it not really a counting sort with a radix heuristic on top?

  • @henrymach
    @henrymach3 жыл бұрын

    What we actually need is to find in which branch of the multiverse the list is already sorted and get it from there

  • @decane9419
    @decane94193 жыл бұрын

    9:27 why is Red not less than Green? Where is it come from?

  • @reborn4612
    @reborn46122 жыл бұрын

    que foda, to amando isso xD

  • @microcolonel
    @microcolonel2 жыл бұрын

    Now: why radix sort looks like it'll be fast, but is actually slower than most common sorts on real computers in common use cases.

  • @gionibegood6950
    @gionibegood69503 жыл бұрын

    It is written somewhere in wikipedia about "spaghetti sort" as a stable n-steps sorting algorithm, but I didn't find the algorithm anywhere, maybe you know...I was interested in a fast, stable algorithm (like radix for big n, or inserting for small n) to write it with intrinsics) I have managed to write only bubble sort with intrinsics 😀

  • @WhatsACreel

    @WhatsACreel

    3 жыл бұрын

    Ha! Spaghetti sort sounds like a brilliant algorithm! SIMD bubble sort for small lists can perform really well!! It is called Odd Oven Sort. I think your intrinsic version would fly :)

  • @gionibegood6950

    @gionibegood6950

    3 жыл бұрын

    @@WhatsACreelafter your movie I'm trying "rank-order" with intrinsics .they say it is the best for small arrays and stable,, I'll let you know the gain comparison with bubble intrinsics stackoverflow.com/questions/2786899/fastest-sort-of-fixed-length-6-int-array * sort6_rank_order_c(uint8_t* d) { //Rank Order uint8_t e[6]; memcpy(e, d, 6*sizeof(uint8_t)); uint8_t o0 = (d[0]> d[1]) + (d[0]> d[2]) + (d[0]> d[3]) + (d[0]> d[4]) + (d[0]>d[5]); uint8_t o1 = (d[1]>=d[0]) + (d[1]> d[2]) + (d[1]> d[3]) + (d[1]> d[4]) + (d[1]>d[5]); uint8_t o2 = (d[2]>=d[0]) + (d[2]>=d[1]) + (d[2]> d[3]) + (d[2]> d[4]) + (d[2]>d[5]); uint8_t o3 = (d[3]>=d[0]) + (d[3]>=d[1]) + (d[3]>=d[2]) + (d[3]> d[4]) + (d[3]>d[5]); uint8_t o4 = (d[4]>=d[0]) + (d[4]>=d[1]) + (d[4]>=d[2]) + (d[4]>=d[3]) + (d[4]>d[5]); uint8_t o5 = 15-(o0+o1+o2+o3+o4); d[o0]=e[0]; d[o1]=e[1]; d[o2]=e[2]; d[o3]=e[3]; d[o4]=e[4]; d[o5]=e[5]; return d; }

  • @TwoThreeFour
    @TwoThreeFour3 жыл бұрын

    He has a microphone, but why his voice is like he forgot to turn the mic on?

  • @shards1627

    @shards1627

    3 жыл бұрын

    most likely the reverb, it wouldn't hurt him to put a rug or a bunch of pillows in the room just outside the view of the camera

  • @WhatsACreel

    @WhatsACreel

    3 жыл бұрын

    Yep, just not great acoustics in this room, unfortunately :( Oh, and my sound engineering skills are pretty hit and miss! Cheers for watching anywho, and have good one :)

  • @WhatsACreel

    @WhatsACreel

    3 жыл бұрын

    That's a really excellent idea! I think it would make a big improvement :)

  • @vhuttyu

    @vhuttyu

    3 жыл бұрын

    What's a Creel? make sure you stay on-axis to the microphone. I can't really see but it almost looks like it's pointing at an angle to your voice.

  • @WhatsACreel

    @WhatsACreel

    3 жыл бұрын

    Sage advice! Well, I recorded the three vids for this little series already, but I'll look forward to improving my mic technique in the next one after that :)

  • @AdlerianTelephant
    @AdlerianTelephant3 жыл бұрын

    Philosophically Wonderful Theoretically Beautiful

  • @holyshit922
    @holyshit9222 жыл бұрын

    If you claim that O(nlogn) is a slow algorithm take the algorithm O(n!) For sorting we can write such algorithm because sorting is in fact choosing permutations which satisfies some condition

  • @SosetaFurioasaJr
    @SosetaFurioasaJr2 жыл бұрын

    Amazing, you're amazing! Thank you very much, matey ! DATA DATA DATA not DATA DATA DATA ! haha

  • @wazydotmeter
    @wazydotmeter3 жыл бұрын

    whats going on wth the back of the monitor

  • @WhatsACreel

    @WhatsACreel

    3 жыл бұрын

    Do you mean it looks dusty? It had a plastic film on it. I removed it, and I think it attract dust now? Cheers for watching :)

  • @klobiforpresident2254
    @klobiforpresident22542 жыл бұрын

    It's tangential to your video but when it comes to "why are there n! permutations?" I like to explain it inductively. How many ways are there to arrange one shape, a circle? Well, one. It's there. Our answer is 1 = 1 (this will make more sense later). How many ways are there to arrange two objects, circle and triangle? Well, two. First we do our arrangement of circle in the back and just out the star in front. Then we put the circle in front and arrange the star in our one way. Exciting stuff. 2 × 1 = 2, so that's our answer. How many ways are there to arrange circle, triangle, and star? Let's first write down that we can put the star in front and do both arrangements for circle and triangle. But then we can also replace the star with the circle and arrange the other two in two ways, and then we can replace the circle with the triangle and arrange the circle and the star in two days. So that's 3 × 2 × 1 = 6 combinations. With four shapes we can apply the same logic. Do our six variants with one shape in front, then replace it with one of the others. We can do four replacements with the other shapes now. So we have 4 × 3 × 2 × 1 = 24. This sort of construction might not seem exciting but it is useful for explaining the amount of permutations possible if not all items are distinct (five red marbles, three black marbles, two blue marbles, or maybe two 436). I realise it wouldn't be helpful for the angle of your video, just consider it neat.

  • @toniokettner4821
    @toniokettner48213 жыл бұрын

    there is a problem with the comparison sorts: it is not true at all that you can halve the number of possible permutations, even if the number is even.

  • @WhatsACreel

    @WhatsACreel

    3 жыл бұрын

    Yes, you are right! Sorting 13 elements takes 34 comparisons, but Log2(13!) ceiling is 33. Sorry if that was misleading. Sounds like you are aware of the following list: oeis.org/A036604 I did try not say specifically that 'only' odd numbers lead to an inability to halve. Might have edited it wrong, but I was aware of that point. It's a great topic, really! So funny how the simplest questions lead to ridiculously difficult problems! What is the minimum number of comparisons required to sort 1000 elements? Nobody knows... :) Anywho, great observation, and thank you for watching :)

  • @KHamurdik
    @KHamurdik3 жыл бұрын

    This reminds me of Hamming Codes inner workings as explained 3blue1brown video. A very strange way felling of simmilarity.

  • @KHamurdik

    @KHamurdik

    3 жыл бұрын

    Implementin exclusion logic in algorithm without using exclusion in algorithm itself. Combination of facts/comparisons is much more than sum of statemnts but rather multiplicaton.

  • @KHamurdik

    @KHamurdik

    3 жыл бұрын

    I really need some sleep

  • @WhatsACreel

    @WhatsACreel

    3 жыл бұрын

    3blue1brown is maybe the best yt vids on the whole net! Extraordinary talent there :) Thank you for watching my vids mate, I hope you had a good sleep :)

  • @paulwomack5866
    @paulwomack586611 ай бұрын

    Sorting gets even more interesting when the data to be sorted is too big to fit in the available random access memory... Sure you can "Just go virtual", but that road could lead to really bad thrashing!