Over 70 Sorting Algorithms in Under an Hour - Already Sorted Inputs

แชร์
ฝัง
  • เผยแพร่เมื่อ 28 ก.ย. 2024
  • I finally revamped the "Run All Sorts" button in w0rthy's program, so here are some new sorts while we're at it! Please let me know if any part of this video is hard on the eyes. I thought it was safe to remove the "Seizure Warning" tag from the title, but I always could be wrong!
    Check out the program here: github.com/Mus...
    Visit the channel Discord here: / discord
    Check out the Mother 1+2 Restoration project: / discord

ความคิดเห็น • 55

  • @DeinonychusCowboy
    @DeinonychusCowboy 4 ปีที่แล้ว +37

    Uh... Uh... quicksort are you okay?

    • @davidcrisp5805
      @davidcrisp5805 4 ปีที่แล้ว +16

      Quicksort - especially with a naive choice of pivot - is notoriously NOT quick when the input is already sorted. There are ways to avoid the pathological cases, but MC is clearly not doing them here.

    • @Musicombo
      @Musicombo  4 ปีที่แล้ว +7

      I'm demonstrating many different pivot selections throughout the video!

    • @charlieferme5274
      @charlieferme5274 4 ปีที่แล้ว +1

      Yeah I think quicksort needs therapy

    • @OutlandishMayhem
      @OutlandishMayhem 3 ปีที่แล้ว

      “Quicksort, go home, you’re drunk”

    • @chaoticprogramming
      @chaoticprogramming 3 ปีที่แล้ว

      It looks like it is selecting the right end as pivot, which is the largest, since it gets slowly closer to the left.
      (Worst case scenario)

  • @RobertSzasz
    @RobertSzasz 4 ปีที่แล้ว +45

    It seems to always make sense to do an "is this sorted" check before anything else since it is trivially fast

    • @rogervanbommel1086
      @rogervanbommel1086 4 ปีที่แล้ว +5

      I agree, in the correct notation that check is O(N), means as there are twice as many elements it takes twice the time, fun fact: radix sort and counting sort are also O(N)

    • @_fluffyy1028
      @_fluffyy1028 3 ปีที่แล้ว +1

      @@rogervanbommel1086 Correct me if I'm wrong, but isn't radix sort O(N * log(R, base=B)) where R is the range of the array and B is the base?

    • @rogervanbommel1086
      @rogervanbommel1086 3 ปีที่แล้ว +1

      _fluffyy that might be right, but the important thing is that there is no N log N or N*N term, big o drops smaller terms

    • @chaoticprogramming
      @chaoticprogramming 3 ปีที่แล้ว +1

      It is so extremely rare to sort something of at least a few hundred numbers that is already sorted... it overall doesn't really matter, since they are so fast.

    • @the_cheese_cultist
      @the_cheese_cultist 2 ปีที่แล้ว

      @@rogervanbommel1086counting sort is O(n+k) when k is the number range

  • @eduardolarrymarinsilva76
    @eduardolarrymarinsilva76 4 ปีที่แล้ว +5

    18:10 Iterative Bitonic Sort is my jam!

  • @floppblackmidi
    @floppblackmidi 3 ปีที่แล้ว +3

    0:58 quicksort is confused

  • @atelektase
    @atelektase 4 ปีที่แล้ว +5

    LL "Quick"sort apparrenly SUCKS on non-completly-random arrays

    • @nunthenihtara608
      @nunthenihtara608 3 ปีที่แล้ว +1

      Stable quick sort: bruh

    • @bbrk24
      @bbrk24 ปีที่แล้ว

      Yeah, it's an O(n^2) sort that pretends to be O(n log n).

  • @charlieferme5274
    @charlieferme5274 4 ปีที่แล้ว +7

    Heapsort: I use the heap property to sort the array
    Heapsort when the array is already sorted: I use the hammer to sort the array

    • @mocaothi7383
      @mocaothi7383 2 ปีที่แล้ว

      Heapsort (Min + Max + Weak + Ternary + Smooth + Poplar): Are these sorted?

  • @kaylaisawesome1631
    @kaylaisawesome1631 ปีที่แล้ว +1

    Sorted

  • @TheForsakenHero318
    @TheForsakenHero318 18 วันที่ผ่านมา

    i swear l/l quick sort sucks so bad compared to the others

  • @kaylaisawesome1631
    @kaylaisawesome1631 ปีที่แล้ว

    Bogo sort is

  • @minnarew
    @minnarew 4 ปีที่แล้ว +4

    seems april fools came late this year
    (jk, but still)

  • @thehearth8773
    @thehearth8773 4 ปีที่แล้ว +16

    Quicksort, or: Much Ado About Nothing

  • @TheComputerGuy96
    @TheComputerGuy96 4 ปีที่แล้ว +14

    There was no need for the "shuffling" animation.

    • @Musicombo
      @Musicombo  4 ปีที่แล้ว +5

      Fair enough.

  • @unrellated
    @unrellated ปีที่แล้ว +5

    Classic Bogo Sort: At last, I have found something I'm good at.

  • @atelektase
    @atelektase 4 ปีที่แล้ว +6

    All the heap sorts (except min) did ALL those comparisons to put the list pack the *same* way it found it

  • @_fluffyy1028
    @_fluffyy1028 4 ปีที่แล้ว +9

    I'm a little confused - if the delay is 1 ms, then how is there a decimal sort time?

    • @thehearth8773
      @thehearth8773 4 ปีที่แล้ว +16

      The sort time is the estimate of how long it would take if the delay wasn't there. It's the amount of time that the program is doing things other than waiting or drawing the screen.

    • @Musicombo
      @Musicombo  4 ปีที่แล้ว +4

      Exactly what Felthry said!

  • @CalculatedRiskAK
    @CalculatedRiskAK 3 ปีที่แล้ว +9

    It's quite evident all of the algorithms that actually do an "is this sorted alrleady?" test. I find it funny that not all sorts do that, since it only gives you a +n on the time complexity. So for Quicksort, the average time complexity would become O(n (1+log n)), but the best would become O(n). And that's only O(n) on the reading time complexity. If it's already sorted, the writing time complexity would drop to O(0).

    • @Musicombo
      @Musicombo  3 ปีที่แล้ว +1

      Well actually... technically, if the writing time is the same for 2k numbers as it is for 16k numbers, then it's considered constant -- O(1).

    • @truongquangduylop33yyuh34
      @truongquangduylop33yyuh34 3 หลายเดือนก่อน

      Ok??​@@Musicombo

  • @user-xx6in8vu6c
    @user-xx6in8vu6c 4 ปีที่แล้ว +3

    Quick sort really out shining the competition here

  • @itzwindows
    @itzwindows 2 ปีที่แล้ว +1

    Weave merge sort.exe has stopped working

  • @ras662
    @ras662 4 ปีที่แล้ว +1

    Hello

  • @DerivativeOfLog7
    @DerivativeOfLog7 ปีที่แล้ว

    I love how IP radix LSD base 10 sounds similar to how it usually does, but not quite as chaotic

  • @nunthenihtara608
    @nunthenihtara608 3 ปีที่แล้ว

    Square root Sort is disconnected

  • @mocaothi7383
    @mocaothi7383 2 ปีที่แล้ว

    This is the fastest collection ever I have seen!!!!!
    Perfect 🤩

    • @mocaothi7383
      @mocaothi7383 2 ปีที่แล้ว

      Wait…
      I was wrong 😨
      Quicksort and Mergesort is so long that it take over 1 minute
      Bad at here 😂
      Edit: Wrong grammar lol

  • @marianellasanchez6480
    @marianellasanchez6480 ปีที่แล้ว

    Can you make a oscilation of arrayV

  • @Raylop69
    @Raylop69 4 ปีที่แล้ว

    11:38