50+ Sorts, Visualized - Already Sorted Inputs

แชร์
ฝัง
  • เผยแพร่เมื่อ 28 ก.ย. 2024
  • Visit our community Discord: / discord
    This bar graph visualization features 54 different sorting algorithms sorting inputs that were already in order.
    *NOTE: Some algorithms with pathological inputs are skipped partway in this video to save time.
    Check out the NEW home for ArrayV here: github.com/gam...

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

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

    Join our community Discord! discord.com/invite/2xGkKC2

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

      I accept the offer but no

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

      I'd much rather be taught

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

    Me: how to sort sorted input?
    Heap sorts: yes

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

      and Wikisort + Grailsort

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

      Merge, bitonic and quick sorts: Yes

    • @SuperBee3
      @SuperBee3 9 หลายเดือนก่อน

      Radix sorts:yes

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

    funny how some of them don't know what to do with an already sorted input

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

    I can almost imagine the algorithms swearing at you, "F#%@ YOU IT WAS ALREADY SORTED"

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

      The Heap Sorts(except Smooth Sort) would just slink away, embarrassed after realizing they messed up the list just to put it back the way it was in the first place.

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

    8:46 looks like Batcher''s Bitonic Sort never disappoints

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

      cuz IT IS Batchers bitonicc

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

      Oh

  • @What-thaW
    @What-thaW 5 ปีที่แล้ว +11

    Gnome, talking to already sorted thing:
    You’ve been gnomed!

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

    9/10 Radix not earrape enough

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

    Bogo sort is most effective in already sorted Inputs

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

      I think thats cuz it checks if it’s right and if not it shuffles

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

      it cant be fastest bc gnome sorts on already sorted array

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

      but wait bogosort is less than a thousand of a milisecond (in real time)

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

      Technically, Gnome Sort, Insertion Sort, and Bubble Sort(that checks if it's sorted) are all just as good.

  • @What-thaW
    @What-thaW 5 ปีที่แล้ว +5

    All heap sorts:
    “Fuck it, might as well just do what we always do!”

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

    So, you're telling me some of these sorting algorithms take milliseconds to complete, but you slow them down immensely for our pleasure?

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

      Yup. Computers are that fast.

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

      @@Musicombo yay

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

      Not time sort

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

    the one dislike was heap sort

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

    Ah yes, thank you weave merge sort

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

    One question - Why isn't Pancake listed under "Impractical"?

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

      Pancake Sort isn't aiming to be fast or slow. It's actually meant to solve a mathematical question.
      en.m.wikipedia.org/wiki/Pancake_sorting?wprov=sfla1

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

      Cuz its already sorted

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

    pancake sort what r u doing

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

    sorts be like
    what
    is it sorted
    wait really?
    can't be let me check 19384 more times

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

    What the hell is Stable Quicksort doing lol

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

      You know how Quicksort has a very bad worst-case complexity? That's what's happening there.

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

      @@Musicombo Well i didn't know a solved state is one of them.

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

      @@Musicombo I had no idea that the worst case for stable quick sort was an already sorted input. That's kinda crazy, actually.

  • @aycc-nbh7289
    @aycc-nbh7289 4 ปีที่แล้ว +2

    But doesn’t Bubblesort detect when an array is already sorted?

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

      I thought so, too. Bubble Sort usually can check for an already sorted input before even beginning.

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

      Udiprod knows

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

      It's not an inherent feature of the algorithm. You have to do extra coding to add that in.

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

    why does base 16 rasix sort always take that long, is it even practical?

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

      Not really. The reason it takes so long is because of all the operations it has to do.

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

      @@Musicombo I still don't understand. Why does it need so many operations compared to other radix sort methods? Or is it all the in place shifting that takes so long?

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

      @@minemon6804 It's all the in-place shifting that takes up its runtime.

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

      @@Musicombo so when you want to place something in position 0 then you need to shift up 2047 elements by one?

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

      @@yxcvbnmmnbvcxy544 Basically.

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

    Should've uploaded this on April Fools.

  • @jl-fy3zj
    @jl-fy3zj 4 ปีที่แล้ว +3

    Anyone else hear those musical notes around 12:35 ?

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

      Its a Windows notification

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

      perhaps a notification in some opened app at the time of recording

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

    Based Gnome Sort

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

    Me, watching the Flash Sort at 7:43 scan the already-sorted array and make 1 swap: YOU WHAT

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

    When slow sort can hardly sort something already sorted

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

    ok, HOW did bogosort not screw things up like Heapsort or what?

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

      it checks if it's good first, then if it isn't, randomly shuffles
      since its first action was a check, it was immediate

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

    I forgot to say Pancake Sort.. It's slow too.

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

    6:56

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

    Silly sort... now with 100% more silly

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

    me: ok its sorted you dont have to do anything right
    silly sort: *lets compare*
    20:00

    • @californium-2526
      @californium-2526 2 ปีที่แล้ว

      572566806 times, as always.

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

      Estimated real time: phew, that was quick

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

    Heapsort brain *cat vibin*

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

    6:27

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

    Grail sort be like boing boing boing boing

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

    Bubble sort does not take 661K comparisons. Only 2047. Your implementation is wrong.

  • @AnhThuNguyen-zz2hm
    @AnhThuNguyen-zz2hm 4 ปีที่แล้ว

    Make them smarter they don't know what to do

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

    WikiSort: (Looks around and found nobody) I'm gonna mess this thing up.
    (Someone comes up)
    WikiSort: (Put it back to normal and pretend nothing happened)

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

    Heapsort: ok first we reverse it.

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

    the only type of sorting where bogo sort gets to be the ultimate best

  • @What-thaW
    @What-thaW 5 ปีที่แล้ว +12

    Min heap sort:
    F l i p.

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

    Why does it still "shuffle" after each sort?
    Its it just there by default?

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

    Algorithms: "Just to be sure it's ACTUALLY sorted, we decided to do it again."

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

    Sorting algorithms with worst-case time complexities of O(n) on already sorted datasets: Pff, this is easy.
    Other sorting algorithms (O(n log n), O(n^2), and worse): WHAT HAVE YOU DONE TO ME?!

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

    Gnome sort: Yep
    Insertion: Yep
    Comb sort: It's just... not... quite... *smooth enough*
    Stable quick sort: ????????????

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

    gnome sort has finally made its redemption.

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

    "Weak heap sort"
    **is faster than all the other heap sorts**

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

      But it uses additional memory unlike others.

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

      @@RedstoneNguyen ok

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

      So glad I'm not the only one who realized that

    • @SuperBee3
      @SuperBee3 10 หลายเดือนก่อน

      Strong heap sort

  • @What-thaW
    @What-thaW 5 ปีที่แล้ว +3

    Insertion sort:
    I was made to be lazy

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

    the gnome and smooth sort seems the quickiest in this case

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

      Well, Insertion also

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

    finally after all this time bogosort gets respect

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

    Beautiful

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

    The bubble sort could easily optimize for the sorted case. Weird that it doesn't. Also odd that Quicksort is doing so well.

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

    Gnome does nothing

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

    M
    M

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

    Radix Went In Reverse For A Bit

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

    Why are you watching this? Like really?

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

    Noooooooooooooooooooooooooooo

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

    Shell sort brain aaaaaaaaaaaaaaaaaaaaaaaahyug

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

    "shuffling"

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

    Dude you literally forgot to shuffle.

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

      Huh?

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

      @@Musicombo •
      **sigh** nvm...

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

      @@kagechu2005BISVG ...Oh, oh my god. Can't believe I didn't get this joke until now. Oops...

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

    bogo sort!
    bogo sort!

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

    Gnome Sort is not to fast, because i think Musicombo forgot to 1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024 and 2048. QuickSort LeftLeft/Pointers are slow too.

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

      I don't understand what you mean here...

    • @official-obama
      @official-obama ปีที่แล้ว

      binary search?

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

    Time sort
    How long will this take
    Time sort: yes
    Me:
    Time sort: 800 seconds

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

    Its a bit late for april fools

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

    Who else thought grailsort would go on forever