50+ Sorts, Visualized - Reversed Inputs

แชร์
ฝัง
  • เผยแพร่เมื่อ 9 มิ.ย. 2019
  • Visit our community Discord: / discord
    This bar graph visualization features 54 different sorting algorithms sorting inputs that are strictly decreasing.
    *NOTE: Some algorithms with pathological inputs are skipped partway in this video to save time.
    Try out the program featured in the video here: github.com/gaming32/ArrayV-v4.0
  • วิทยาศาสตร์และเทคโนโลยี

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

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

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

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

      Rip no likes :(

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

    You: Gnome Sort
    The Guy she tells you not to worry about: Optimized Gnome Sort

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

    "Yo pass me the aux cord"
    "You better not play trash"
    *plays the In-Place Radix LSD Base 16 Sorting of reversed inputs with 2,048 numbers*

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

    Every other sort-uses givin values
    Gravity sort-yall mind if I just *c h a n g e t h e v a l u e s*

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

      What if i set them all to the same value BOOM
      Sort skill 100

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

      pizza mozzarella pizza mozzarella rella rella rella rella

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

      @@tiporial this comment could be a big hit in Europe

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

      9:46

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

    18:20 "ok let me fix that... wait... no... what's going on??"

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

      This comment is not cool 😻💪👎🤙👎😽💪👎😻👎🙀👎😼🤞🎃👺👹

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

      Ixpantenco it's pancake sort

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

      @@estergallardo3594 And you're cool I suppose?

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

      It's just robot

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

      @@spedur3361 found the thirteen year old

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

    Programmers in theory: look at all these options we have for sorting in different situations
    Programmers in practice: std::sort

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

      superscatboy truu

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

      Pigeonhole sort requires a limited range of integers (or equivalent). Using pigeonhole to sort a list containing just the numbers 1 and 1 trillion (1000000000000) requires 8TB of storage for example. It's great when you have a large set of integers in a small range, but that's almost never the case in practice.

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

      quicksort when

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

      _Arrays.sort();_

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

    16:27 when you have five minutes left to finish all the questions in your exam

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

      lmao that actually made me nose laugh

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

      nose expiration
      ye lmao, it got quick so weirdly

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

    I finally understand how gravity sort works! It doesn’t sort by moving, it changes the value of the item in each place until it’s the right value for that place

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

      Yup! Uses a lot of scratch space in memory to do all that subtracting/adding, as well.

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

      What is min heap sort then?!

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

      @@Musicombo how about counting sort?

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

      Can you give an example using numbers?

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

      @@mrninjagon270 @chacha charlie well technically you can consider non descrete values to be discrete, but there is only 1 of each value. It would be really inefficient, not impissible for the counting sort

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

    Smooth sort: is called smooth sort
    Also smooth sort: 5:24

    • @yonka-cola8792
      @yonka-cola8792 4 ปีที่แล้ว +23

      Spiky

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

      pointy sort

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

      I was just about to say that ! It's literally the least smooth of all, maybe excluding heap sort variants.

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

      Casey Ashworth I think it’s called smooth sort due to how quick and clean the sort itself is

    • @ray-without-organs
      @ray-without-organs 3 ปีที่แล้ว +1

      Ru²Kanga clean?

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

    17:21 Introsort: Well, I just completed my task, better celebrate!

  • @wow-uf9ke
    @wow-uf9ke 5 ปีที่แล้ว +762

    pancake sort be like
    bruh

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

      Man, not all sorting algorithms are designed to work with purely this type of data. Probably it was developed for something very specific

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

      Yeah, it certainly is. I got time and checked. The only available operation is element flipping, so it just wasn't designed to work in this data type

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

      18:20
      The sort took 3 minutes

    • @-1f
      @-1f 4 ปีที่แล้ว +5

      my mans be like bruh

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

      dannad x what the heck is pancake sort for then?

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

    2:12 looks like a rotating 3D image. Nice

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

    Set Playback Speed to 2 to improve the algorithms

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

    4:43 And here, you see a sorting algorithm sorting a reversed input to another reversed input...

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

      Min heap sort is just wrong.

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

      4:49 SIKE

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

      @@edwardclark6731 no

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

    9:57 wait that’s illegal

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

    is this how they made earthbound sounds

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

      Hahaha :P

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

      No.

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

      @@jacobw1780 r/woooosh

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

      @@Pedro270707 O H N O

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

      pk algorithm

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

    2:50 my guinea pigs when I'm cutting bell peppers.

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

      I’m glad someone had the same idea!

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

    poor pancake sort

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

      18:22

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

      It tried, but it just wasn't enough

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

      Still faster than bubble sort

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

      It's a joke sort so its born to be trash unfortunately

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

      It's just showing off.

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

    Patience Sort: get your popcorn and take a seat, we're gonna be here a while
    Also Patience Sort: 2 seconds

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

      thats terribly inefficient if it was real time

  • @aether-music
    @aether-music 4 ปีที่แล้ว +32

    16:24
    "Nope, I'm done"

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

    26:34 So we've made the pattern just the reversed version of what the order is supposed to be, so its easier for you to sort them.
    Less Bogo Sort: Ok...

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

    Bogo Sort can be the fastest sorting algorithm, with the chance of happening of 1/n!

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

      I may be late but is that 1 over n factorial or is it an excited 1 over n ?

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

      @@DragoStar this is probably a joke, but hey, anyway it's n! since thats the total number of ways to order n elements

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

      @@DragoStar 1 over n factorial

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

      @@DragoStar 1 over nfactorial

  • @FM-lc6hp
    @FM-lc6hp 4 ปีที่แล้ว +75

    i really love 10:36 so much! easy algorithm and yet best performance~

    • @californium-2526
      @californium-2526 3 ปีที่แล้ว +12

      Ah yes. 573 microseconds ERT, just behind of TimSort (391 microseconds ERT, 16:32)
      It's a storage and memory (?) hog though.

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

      pigeonhole sort just built different

    • @entredus7910
      @entredus7910 4 หลายเดือนก่อน

      elements 1 and a really, really big number

  • @dr.jacksonbright5723
    @dr.jacksonbright5723 3 ปีที่แล้ว +57

    Imagine using silly sort on a comically small set, thinking “maybe it’s silly’s time to shine,” only for your computer to freeze for seventeen and a half seconds before presenting a sorted set

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

      A set of 256: 17,5s
      A set of 2048: 1m41,6s or something

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

      It doesn't work like that; it's not linear complexity. 2,048 items would probably take over a day.

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

      @@Musicombo Ah, the beauty of O(n^(log n)) (didn't know that it was that bad while I was making that comment)

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

      Silly Sort took 572 MILLION COMPARISONS to sort 256 items!! XD

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

    10:29
    _What._

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

    21:34 flight of thr bumblebee

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

    Love how the smooth sort (5:24)is in no way smooth

    • @bingobeego
      @bingobeego 11 หลายเดือนก่อน

      LMAO

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

      Smooth sort actually roughened up the surface of the triangle

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

    5:25 I’m sure that is not smooth it looks sharp

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

      no

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

      I’m pretty sure it’s called that due to the sporting not being sloppy or confusing as others

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

      smooth heaps: *am i a joke to you?*

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

      Future me: *Yes. Yes you are.*

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

    When bad sort gets to be one of the fastests

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

      Good sort

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

      well it doesnt use as much numbers so...

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

    Batcher's bitonic: *"yes, but actually... no"*

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

      it does make some pretty fire beats if i say so myself

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

      That's just what happens when you're literally the opposite of adaptive!

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

      That’s at 12:58

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

      Also what the $%#&?????

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

      And then there's Pancake sort at 18:20.

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

    Base 16 looks like it’s trying to say something

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

      Sounds like it's trying to say something; not sure whether that's what you meant to say or just what I think

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

      11:11

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

    TimSort be like: "Y'all mind if I just flip the array?"

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

    12:58 Batcher needs to make up his mind

  • @ZA-mb5di
    @ZA-mb5di 4 ปีที่แล้ว +131

    17:21 sounded like All Star for a second

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

    I like how min heap sort went through the whole heapification process to only end up back where it started

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

      See, YOU can see all the items at once , but the algorithm cant. It can only compare two items at a time. To us, it just looked like Min Heap Sort turned a reverse array back into a reversed array. But to Min Heap Sort, it turned an array of didn't know was reversed, to an array it DID know was reversed.

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

    I like it when the red line is stuck focusing on one point like it's working super diligently to sort the things in the area, then it goes to another place and starts again

  • @Jack-lp3gc
    @Jack-lp3gc 4 ปีที่แล้ว +38

    so is no one gonna point out that min heap sort did a bunch of stuff to the inputs only to get right back to where it started and then flip it around

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

    I thinks it's absolutely amazing that bogo sort with 8 inputs took nearly 10x as long (estimated) as quicksort with 2048 inputs

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

      And that’s without even talking about pigeonhole sort

    • @kingsley.
      @kingsley. ปีที่แล้ว

      @@Hasde_dfs tim sort

    • @rexperverziff
      @rexperverziff 11 หลายเดือนก่อน

      @@Hasde_dfstime stamp?

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

      Wait til you see BOGOBOGO sort…

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

      ​@@locrianphantom3547with 10 inputs!!!!

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

    2:17 it looks like a hole in a box lol

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

    I like the ones that don't even maintain the integrity of the original data but somehow put it all back at the end, like the gravity sort

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

    12:27 The sound of 100, 500, and then 1000 point enemies being destroyed.

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

    Counting sort: I am speed
    Patience sort: You are quick, But im faster

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

      Time Sort: Hold my beer

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

      TimSort: Try me bitches

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

      Pigeonhole Sort: Boom, done! What now?

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

      Pancake sort: YOU DARE OPPOSE ME MORTAL
      Hold on gotta scan the algorithm 69420 times before confirming its sorted

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

      pancake sort: merry christmas 2016!

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

    3:02 if you listen closely it almost sounds like megalovania

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

      Obviary god damnit take my like

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

      42th

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

    I'm surprised Pancake Sort didn't see the obvious solution of just flipping the entire stack once to get it in the correct order. I presume there's a limitation to the algorithm (which I am unfamiliar with) that forces it to start inside the stack, thus preventing it from just flipping the whole thing in one shot.

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

      Pancake Sort searches for the largest item in the remaining list, and then reverses the part of the list ranging from the first item in the list to the largest item. For example, if the largest item is the 50th item, reverse the order of the first 50 items. This puts the largest item(in the remaining list) at the front of the remaining list. Then you reverse the ENTIRE remaining list, putting the largest item in the last position in the remaining list. Then redesignate the last(largest) item as part of the sorted list. Then do it again on the remaining list, until it reaches a length of 1 item.
      It's basically Selection Sort, but made much worse for no reason.
      So, in this case, on the first iteration, it finds the largest item(already the first, as the list is in descending order), then reverses the list from the first item to the largest item(since this is a list of 1 item, nothing happens), then reverses the entire list, which sorts it. But the algorithm doesn't check if the list is sorted, it just searches for the largest item in the remaining list. Because it reversed the entire array, putting it in ascending order, the largest element in the remaining list is at the end, making the algorithm reverse the entire list to put the largest item at the beginning, then reverse it AGAIN to put it at the end and thus sort it. But it isn't checking, every time it reverses the array, if it's sorted.
      In short: although it sorts the list in "one shot," it doesn't KNOW if did that, cause it didn't check. Hope that answers your question.

  • @ATtiny13a-PU
    @ATtiny13a-PU 4 ปีที่แล้ว +78

    11:10 - is drop from dubsteb

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

    Nobody:
    Old PCs when you put in a CD: 18:13

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

      Whoops! You have to put the CD in your computer

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

    9:57 Perfectly balanced, as all things should be.

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

    Where's that comment with the list of sorts?

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

      Gone Reduced to atoms

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

      Seems not sorted yet

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

    11:11

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

      the time, the sort, the mathematical perfection of it all

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

    batchers bitonic be like:
    Ok yeah, go there, uh huh, wait stop! Go back, go back. go right there. Yeah. WAIT NO COME BACK HERE!

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

    16:32 timsort's not having any of this reverse bullshit

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

    Some of those look to me like (1) read the list (2) print the sorted list is the whole algorithm. I can not even begin to guess what is going on.
    Also, silly sort looks like a merge sort that got neurotic and is afraid the list might change when he is not looking

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

      They use auxiliary data structures. The visualization really should show them

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

    Batchers Bitonic Sound be like:
    "now i know this might look like the exact same thing but just hold on for a bit"

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

    7:52: the best one

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

      Merge sort is kind of how people sort things, you group similars together and then pick out the similarities to those groups and so on until 0 to 100 are lined up

  • @Guinea.Pig-Gaming
    @Guinea.Pig-Gaming 4 ปีที่แล้ว +73

    odd-even sort looks like a 3d structure changing shape.

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

      It does tho

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

    Is no one going to mention that at one point gravity sort had all of the numbers the same?

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

      You should look up gravity sort. It's a really cool concept. You could build a physical system using it to sort in linear time. It is also called bead sort

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

      It's pretty cool but unfortunately it's not very efficient

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

      I saw from another comment that it changes all the values until its the right value for the place

    • @cephalosjr.1835
      @cephalosjr.1835 4 ปีที่แล้ว +4

      Choinkus Gravity sort is only good on specialized hardware. Of course, if you implement it on hardware, it’s very fast.

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

      @@ironoat I know

  • @IronBoy-hf2lp
    @IronBoy-hf2lp 4 ปีที่แล้ว +18

    @ Pancake Sort: BRUUUUH WHAT ARE YOU DOOOOOOING

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

    Pigeonhole sort is like "I SEE THROUGH THE LIES OF THE *reversed inputs"*

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

    Time sort: Estimated Real Tome: 8,192 ms
    That’s only 8.1 seconds, but it feels like eons compared to the rest of the sorts...
    Edit: never mind. Silly sort and slow sort killed it. Lmao.

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

      Yes, because time sort works by waiting in many threads at once.

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

      Tournament sort?

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

      That's because time sort isn't a real sorting algorithm. As the air accumulator said, time sort is just a horrible abuse of the system's scheduler - it creates one thread for every element, makes them wait (value of the element × 4) milliseconds then push the element onto the end of the output array, then insertion-sorts that array.

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

      Slow sort

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

      @@lithiumwyvern_ ngl that's kinda genius

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

    Everyone gangsta til odd-even sort makes the sorting 3D

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

    Really shows the difference between n^2 vs nlog(n)

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

    I find pancake sort very funny when it starts swapping rapidly towards the end

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

    I wish you would do a bit of color coding for what state the sorts are actually in- say green for "known to be sorted", and maybe separate colors for each layer of heapsort's heap

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

    No matter what the sorting video is, Radix LSD Base 4 NEVER fails to impress me in terms of awesomeness and beauty. :)

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

      And it also sounds great.

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

    This made me curious, is there an algorithmic way to find the specific “worst case scenario” for any given sort? Between this and the already sorted inputs, it certainly seems like there are some non-random arrangements which take excessive amounts of time compared to a normal sort.

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

      It's probably more often that people have just come across worst cases for these sorts, but I'm not sure about an algorithm. I would be curious about that, too!

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

      I'll try to prove that there doesn't exist a general algorithm for that, in a similar way that you prove that there is no general way to solve the halting problem:
      Assume that there is an algorithm A(s, i), that tells you whether an input i is the worst case input for a given sorting algorithm s
      Construct sorting algorithm S, that given A(S, i), will sort using quicksort if i is the worst case input, and otherwise use bogosort (or any other algorithm that is going to be slower than quicksort)
      But, this means that for I = worst case input for S, A(S, I) /must/ say that I is not the worst case. Therefore, there exists no general algorithm A that can determine if a given input is the worst case scenario for a given sort.
      I hope this makes sense :)

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

      @@erikprantare696 That does, thank you so much!!

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

      "Between this and the already sorted inputs, it certainly seems like there are some non-random arrangements which take excessive amounts of time compared to a normal sort."
      While that seems true, there are exceptions. For instance, insertionsort is faster for "nearly-sorted" and "completely sorted" lists than for ones that have random data. In fact, it's why one method used to speed up something like quicksort is to simply do nothing when partitions are fairly small, then when that whole thing completes, run insertionsort on that mostly-sorted list.
      edit: What I'm getting at is that the same non-random arrangements don't affect each sort the same way.

    • @Fera-gr5mm
      @Fera-gr5mm 4 ปีที่แล้ว +3

      Brute-force algorithm might go through all n! permutations and measure it manually.

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

    i love how batcher's odd-even merge sort just *transitions* the values

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

    2倍速で聴くとめちゃくちゃ気持ちいいです!
    I love listening to it at double speed.

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

    Ahhh yes it's this time of the year.... youtube strikes again with that algoritm stuff

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

      The algorithm wants to show off its family

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

    Why am I watching sorting videos when I don’t even know math

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

    Quick sort is the one true god... considering its performance and how quick it is to write

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

      Except this is actually the worst case scenario

    • @Fera-gr5mm
      @Fera-gr5mm 4 ปีที่แล้ว +1

      @@romajimamulo Only if it was choosing the last/first element. In this case, the middle element is the median, so this is pretty effective.

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

      @@Fera-gr5mm That is true.

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

    its cool how with starting reversed some sorts approach a fractal pattern initially

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

      Then there's Odd-Even

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

      Base16 made some sort of rbg boss battle theme intro

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

      @@icebearpl188 some *_sort_*

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

    5:26
    Cha cha real smooth

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

    Pigeonhole sort (10:37):
    *I AM SPEED*

  • @CatFace8885
    @CatFace8885 7 หลายเดือนก่อน +1

    Pancake sort constantly reversing the already sorted array over and over not knowing any better is such a moment

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

    Batcher's bitonic sort: shakes a bit here and there, decides that it is wrong, Puts it back, and then decides that it prefers the list sorted.

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

    I always found it strange why block sort algorithm seem to, for lack of a better word, carry numbers along while sorting.

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

      That's their internal buffer!

  • @52.yusrilihsanadinatanegar79
    @52.yusrilihsanadinatanegar79 3 ปีที่แล้ว +4

    Batcher's Bitonic Sort
    "wait, let me merge it in"
    "oh wait, there is a problem"
    "ok then, i'll reverse it back to fix that problem"
    "oh wait, it's the input"
    "let's merge it all to-"
    "r e v e r s e a n d m e r g e"

  • @aaplies8879
    @aaplies8879 11 หลายเดือนก่อน

    I really have to appreciate min heap sort (4:38) taking all the extra time to reform the input then flip it.

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

    5:23
    Selection Sorts: Smooth Sort
    Looks: *Rough*

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

    They really improved radix base 16 from deafening noises to sorting data. Very creative

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

    5:26 sounds like pulling off a long piece of plastic on a new surface

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

    Gravity sort be like:
    1) have values to sort
    2) look at them
    3) ???
    4) profit

    • @californium-2526
      @californium-2526 3 ปีที่แล้ว +1

      A slow one though.
      Pigeon hole sort, counting sort and TimSort would have fit.

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

    this is exactly what i was looking for

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

    imagine you had 8 pencils and had to do 125984 comparisons, 585800 swaps and 1171600 writes to main array to sort them from smallest to biggest. thats the bogo sort. (27:01)

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

    Quick Sort is known to be pretty bad in this case, as well as when it’s already pretty much in order. On the contrary, Heap Sort(s) are known to be pretty darn good in every case.

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

      Well, a reversed array is necessarily a heap, so Heap Sorts already have half their work done for them in this case. I imagine they don't do so well if the array is sorted/is close to being sorted, because an array in ascending order is what might be dubbed an anti-heap--no part of the heap is correct.
      Quick Sort only struggles because usually, it's programmed to just choose the last item as the pivot, which is bad If that's the biggest/smallest item. If you code it to just pick a random item from the list as a pivot, though, it performs just as well as any other time.
      Also, Heap Sort is the worst O(n log n) sort on average, and Merge Sort does better in "all cases." So you're wrong .

    • @bingobeego
      @bingobeego 11 หลายเดือนก่อน

      ​​@@BigFatWedgeigeonhole? Or even timsort

  • @ClownyGamer
    @ClownyGamer 11 หลายเดือนก่อน

    I finally know how merge sort works! So when there’s a shuffle, every value is what it is just like of place of course. Merge sort works by taking an out of place value and putting it back into its correct place and then there are a couple hundred more values that need to be merged, so when there is half the value of one spike or colour the merge sort will literally merge into 1 whole. In that case being 100 percent. And this pattern is repeated 10 times until the whole thing has been sorted.

  • @entropic-decay
    @entropic-decay 4 ปีที่แล้ว +21

    odd-even sort: *just turns it around in 3D*

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

    the odd-even looks so sick

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

    11:14 - this reminds me of Metroid Prime title screen for some reason

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

    Great video! I just have a question: how long did it take for all of this to complete?

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

    Me after a gaming session in bed 4:50AM looking at pancake sorts jokes at a youtube video

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

    heap sort is extremely powerful here because it's already all in a heap

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

    Is it me or did Bogo Sort get quite lucky there?

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

    stable quick sort was like trying to start an engine, and it finally starting

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

    Those Deathgrip boys are always innovating

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

    4:30 you would think the min heap sort would figure it out super quick but noooo... 🙄🙄🙄

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

    08:08 Visualized merged sort reminds me of 2048 XD

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

      Same

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

      Are you from there future? What's it like in 2048?

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

      So when I play 2048, I'm just being a very slow sorting algorithm?

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

    12:57 "maybe if i put this he- no that dosent work. maybe if i did thi- no that dosent work either. maybe if i jus- oh god now i gotta start all over..."

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

    All hail bogo sort

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

      True, bogo sort can sort any array faster than any other algorithm

    • @Bee-bup
      @Bee-bup 3 ปีที่แล้ว

      @@Choinkus lol

  • @VoidGravitational
    @VoidGravitational 11 หลายเดือนก่อน +1

    Min Heap Sort: Oops why did i do that lets revert that
    Also Min Heap Sort: *reverses the bars*