Stalin Sort (Not Sorted in the way you expect it to be)

Поділитися
Вставка
  • Опубліковано 9 тра 2023
  • Program is Gaming32's ArrayV
    github.com/gaming32/ArrayV

КОМЕНТАРІ • 265

  • @thehexagon821
    @thehexagon821  10 місяців тому +726

    I assume y'all came from Ardens?

  • @omegahaxors3306
    @omegahaxors3306 10 місяців тому +4897

    My favorite variation of Stalinsort is "The list is sorted. Any algorithms which disagree are flagged for reeducation"

    • @excrubulent
      @excrubulent 10 місяців тому +216

      Hard to argue with O(1).

    • @dm121984
      @dm121984 10 місяців тому +89

      Nah, disagreeing algorithms just.... disappear.

    • @omegahaxors3306
      @omegahaxors3306 10 місяців тому +44

      @@dm121984 Dissappear? Ha ha ha ha no. Hey that reminds me of a funny fact. Did you know that one in three people in the Soviet Union is a reactionary counter revolutionary? [Both me and excrubulent stare right at you] if you hate gulag so much, why are you going there?

    • @WalnutBun
      @WalnutBun 10 місяців тому +6

      Orwellsort

    • @ducouscous2867
      @ducouscous2867 10 місяців тому +4

      @@omegahaxors3306 Actually on the highest spike there were less than 2 million people in the gulags under Stalin, most of them were nazi soldiers. Most of the horror stories come from theme along with Goebbels propaganda, they forget to say that the prisonners were paid, had access to theaters, shops, etc. and that mortality rates didn't go above 10% except during famines / war while it was going way above 50% in nazi camps. Last but not least the gulags weren't the only prison and there were corrective labor colonies were you had to work but you were free to go after your working day. Gulags weren't a paradise but there were certainly not extermination inhumane camps (French and US prisons way worse) and not the only incarceration possibility in the soviet union.

  • @themune2541
    @themune2541 10 місяців тому +1774

    the fact that it turned all red is a nice cherry on the top

    • @byteatatime
      @byteatatime 10 місяців тому +55

      @@starfowlshift He's referring to communism i think

    • @jessh4016
      @jessh4016 10 місяців тому +6

      @@starfowlshift Autism?

    • @kipchickensout
      @kipchickensout 10 місяців тому +1

      @@byteatatime i think so too

    • @AwesomeCadecraft
      @AwesomeCadecraft 10 місяців тому +26

      lol when it turned red i expected a hammer and sickle to appear in the corner

    • @vibaj16
      @vibaj16 10 місяців тому +3

      @@starfowlshift how does it decide what to delete? 1 4 2 6 3 could also turn into 1 4 6

  • @garlicohen960
    @garlicohen960 10 місяців тому +2355

    If every data is identical, then no more sorting is required. True efficiency.

    • @circuitbreaker08
      @circuitbreaker08 10 місяців тому +13

      And everyone will br equal too!

    • @_b7090
      @_b7090 10 місяців тому +36

      That's not even what Stalin sort is

    • @Czecherboard
      @Czecherboard 10 місяців тому +45

      There is a little bit of different data at the left.
      The sort takes the first two, and if the second is smaller, it deletes it. Then again, and the result is a sorted array, even though with data loss. Here only 3 numbers survived

    • @alessiomuccio2795
      @alessiomuccio2795 8 місяців тому

      Look at the top left: not every data is identical: it's a visual problem. What Stalin sort does is sending to the gulag (eliminating) the unordered data, so that only data that was already in order stays in the list

    • @zagrfige
      @zagrfige 4 місяці тому

      @@Czecherboardlooks to me like 6 survived

  • @idkyet9458
    @idkyet9458 10 місяців тому +1046

    yep looks pretty sorted to me

    • @thehexagon821
      @thehexagon821  10 місяців тому +140

      yeah true, but only the ones that didn't go to the gulag haha

  • @ZmanVlog
    @ZmanVlog 10 місяців тому +639

    Was fully expecting it to just delete half of the numbers, but this is definitely just as funny.

    • @antthegord9411
      @antthegord9411 10 місяців тому +7

      I felt this exact sentiment as well lol.

    • @clownball3457
      @clownball3457 10 місяців тому +22

      thanos sort

    • @snowykoyuki
      @snowykoyuki 10 місяців тому +68

      That's exactly what it did, it deleted the ones that aren't in order, which is more than half of them

    • @vinccool96
      @vinccool96 10 місяців тому +26

      It deletes the ones that aren’t sorted, but the program used can’t represent removal of values

    • @Robosium
      @Robosium 7 місяців тому

      no, that's thanos filter

  • @SpeckyYT
    @SpeckyYT 10 місяців тому +1424

    technically stalin sort is just a filtering algorithm, but at the end the output is sorted, so it's not wrong to say that it's a O(n) sorting algorithm 😂

    • @jameshogge
      @jameshogge 10 місяців тому +71

      I think one requirement of a sorting algorithm is that the output is a permutation of the input 😉

    • @viktorhansen3331
      @viktorhansen3331 10 місяців тому +19

      It's very wrong. The output of a sorting algorithm should be an ordered sequence comprising the elements of the input.

    • @TJackson736
      @TJackson736 10 місяців тому +62

      ​@@viktorhansen3331it is an ordered sequence of the elements of the input list. Just not all of them.

    • @JonBrase
      @JonBrase 10 місяців тому +58

      ​@@TJackson736All the elements of the input list are in the output list. *glares threateningly* If you want, we can take you to visit the elements of the output list that you claim are missing.

    • @cezarcatalin1406
      @cezarcatalin1406 10 місяців тому +25

      @@jameshogge
      There’s a variation of “Stalin sort” that goes like this:
      Take out all out of order elements from the original list, throw them in a gulag list.
      The gulag list now becomes the original list.
      Repeat the same thing recursively until you are left with a short sorted list.
      Finally, re-combine all sorted lists (like you do in a merge sort).
      It’s a relatively efficient algorithm.

  • @mdhasiburrahman16
    @mdhasiburrahman16 10 місяців тому +506

    You will find the rest of the data in the gulag

    • @Siwdvi
      @Siwdvi Місяць тому

      "424 LIkEs And nO RElPieS????? LLEmmeE fIX That 🤓🤓🤡"

    • @bobbywatson942
      @bobbywatson942 Місяць тому +1

      @@Siwdviuh

  • @Balsiefen
    @Balsiefen 10 місяців тому +362

    For element n:
    if n+1 = n, keep
    if n+1 ≠ n, send n+1 -> gulag

    • @raffimolero64
      @raffimolero64 10 місяців тому +33

      Did you mean
      if n+1 >= n, keep, else Gulag

    • @shawermus
      @shawermus 10 місяців тому +6

      ​@@raffimolero64no, it doesn't account for variables below

    • @NikoCubeRoot
      @NikoCubeRoot 9 місяців тому

      👊

    • @Fvogmage
      @Fvogmage 9 місяців тому

      I did, it send those gulag

    • @cheesebusiness
      @cheesebusiness 8 місяців тому +2

      @@shawermusNo it does. The goal is to remove elements that make the array unsorted, not that make the array unequal.

  • @MinorLife10
    @MinorLife10 10 місяців тому +221

    I like how it just eliminates all the elements not fitting. The name is justified

    • @japanpanda2179
      @japanpanda2179 Місяць тому

      It doesn't eliminate them, it just turns them into the same as the previous element unless it's already higher.

  • @RC-1290
    @RC-1290 10 місяців тому +254

    Removing every element that was not already in the desired order. I had to search the internet to get that description. This video would benefit from having that in the description.

    • @JansthcirlU
      @JansthcirlU 10 місяців тому +14

      Thank you for this comment. I get very anxious if I'm not being spoon-fed literally everything about everything.
      Your comment saved me precious time and strain on my mental health. Simply imagining having to type in "Stalin sort" in Google and determining which result is the most suitable, let alone having to read and interpret the result is enough to give me goosebumps.
      Thanks again from the bottom of my feeble heart.

    • @ahG7na4
      @ahG7na4 9 місяців тому +8

      ​​​@@JansthcirlUoh noes, how dare they ask for context on a meme algorithm.
      you are like that talking ant in the East German cartoon

    • @RC-1290
      @RC-1290 8 місяців тому +20

      Perhaps ​@@JansthcirlU actually gets anxious when receiving useful information or reading constructive feedback. Writing passive aggressive comments may well help them cope.

    • @botanich
      @botanich 7 місяців тому

      ​@@JansthcirlUok redditor

  • @gengis737
    @gengis737 8 місяців тому +32

    For element n:
    if n+1 < n, send n -> gulag
    if n+1 = n, keep
    if n+1 > n, send n+1 -> gulag
    When count(gulag) > 20% count(population), exit loop; delete developer.

  • @noobnesz
    @noobnesz 10 місяців тому +14

    Was expecting the USSR Anthem to play when everything turned red

  • @abdillahahmad7025
    @abdillahahmad7025 3 місяці тому +4

    This video even has the "scream" of people being eliminated by the algorithm

  • @MizoxNG
    @MizoxNG 10 місяців тому +9

    The rule of the game is we all are the same and our lines will form unbroken rows

  • @DarkManifesto
    @DarkManifesto 10 місяців тому +11

    He was right, I truly did not expect this.

  • @Chicken-bu1tw
    @Chicken-bu1tw 10 місяців тому +144

    funfact it works by removing any sort that is not the same as the rest (similar to how stalin did it. hence stalin sort)
    edit: why tf does this almost have 150 likes

  • @Inf1e
    @Inf1e 10 місяців тому +48

    You can recursively stalinsort, then merge))

    • @hermask815
      @hermask815 10 місяців тому +5

      There is no amnesty. Recursion is inherently amnesty.

    • @hermask815
      @hermask815 10 місяців тому +1

      Except the recursion is made before, but then Stalin would get suspicious.

    • @livedandletdie
      @livedandletdie 10 місяців тому

      But if you don't delete the unordered datapoints, it isn't stalinsort. But sure, you could take all sorted elements, then save that as it's own group and then repeat that process on the rest of the list of unsorted elements, until you have however many groups you get out of it, then you could stack all this groups in reverse order and then repeat this pseudostalinsort over and over again, and eventually you'd get a fully sorted list.

    • @user-oe3zl3nd1o
      @user-oe3zl3nd1o 10 місяців тому +8

      This would be more of a Khrushchev sort with this kinda liberties

    • @worldspam5682
      @worldspam5682 10 місяців тому

      Nah, sounds too capitalistic... and humane

  • @HiddenAnderKSI
    @HiddenAnderKSI 10 місяців тому +4

    Stalin Sort: *RED* Mathematics

  • @Name_Pendingg
    @Name_Pendingg Місяць тому

    yep, that works, and was not expected. other sorting algorithms really need to take notes

  • @TsarVladolfPutler
    @TsarVladolfPutler Місяць тому

    Ah yes the good ol' Stalinsort: "The list is sorted. Any one who disagrees will be sent to Gulag"

  • @bouncycow3010
    @bouncycow3010 10 місяців тому +4

    Ah, so this is how Stalin sorted his lists

  • @1grapefruit
    @1grapefruit 10 місяців тому +51

    i love turning sorting algorithms political

    • @brainletmong6302
      @brainletmong6302 10 місяців тому

      In this case it's the other way around

    • @manender1020
      @manender1020 10 місяців тому +28

      ​@@brainletmong6302 political algorithms sorting turning love I?

    • @graypalks
      @graypalks 10 місяців тому +2

      Man, I wish they would make a Hitler sort.

    • @dirhi
      @dirhi 10 місяців тому +8

      @@graypalkswhat

    • @manender1020
      @manender1020 10 місяців тому +3

      @@graypalks it will just wipe out random values until it has any

  • @no_name4796
    @no_name4796 Місяць тому +1

    Stalin sort:
    version a: delete all unsorted data
    version b: it was actually sorted all along (plz don't send me to the gulag)
    version c: all data is equal, thus there is no need to sort (altough some data is more equal than other)

  • @gragal82
    @gragal82 3 місяці тому +1

    Incredible inclusivity and equality

  • @thecertifieddoctor
    @thecertifieddoctor Місяць тому

    that's exactly the way i expected it to be

  • @Manchweld
    @Manchweld 10 місяців тому +34

    I expected this, because I know the practices of Joseph Stalin. (He was hot in his 20s tho)

  • @ghostbirdlary
    @ghostbirdlary 10 місяців тому +2

    if it was a stalin sorting algorithm 2 lines would be at the top and the rest would be destitute or disapear

  • @Hiandbye95
    @Hiandbye95 10 місяців тому +32

    Could you sort the whole list by filtering the remaining items, then the remaining items, and so on?

    • @aycc-nbh7289
      @aycc-nbh7289 10 місяців тому +6

      That sounds like a sort of recursive sorting algorithm.

    • @SupremeCalamitas789
      @SupremeCalamitas789 10 місяців тому +6

      Sort list, all not sorted send to Gulag
      Sort Gulag, all not sorted send to Gulag Gulag?
      Sort Gulag Gulag, all not sorted send to Gulag Gulag Gulag

    • @NguyenPhuong-jr4tp
      @NguyenPhuong-jr4tp 10 місяців тому

      That sounds like "divide and conquer" algorithms. One I like the most is quick sort, like exactly you describe

    • @exedeath
      @exedeath 8 місяців тому

      Its called Safe Stalin Sort

  • @clopec
    @clopec 10 місяців тому +3

    Works by removing undesirable elements.

  • @milescantfeelhisthroat9679
    @milescantfeelhisthroat9679 9 місяців тому

    "Nah, i'mma do my own thing"

  • @exedeath
    @exedeath 8 місяців тому

    Does it remove number at position N if its bigger than number at position N +1, or it removes number at position N + 1 if number at position N is bigger than N +1?

  • @BobChess
    @BobChess 7 місяців тому

    The quickest sort algorithm!

  • @thermitty_qxr5276
    @thermitty_qxr5276 25 днів тому

    *Our Sorting Algorithm*

  • @fpskkkk
    @fpskkkk 10 місяців тому

    A truly O(n) algorithm, very good

  • @pattttttrick
    @pattttttrick 10 місяців тому

    See it, say it, sorted

  • @vinaythakur4742
    @vinaythakur4742 10 місяців тому +17

    UA-cam: "People will watch anything under 59 seconds ✨"

  • @Rockys-Studio
    @Rockys-Studio 3 місяці тому

    "Sorting....
    Verifying...
    sorry we cant allow short lists"

  • @CasimirPL
    @CasimirPL 10 місяців тому +1

    after sorting will sound soviet union anthem

  • @Just_Your_Average_Goose
    @Just_Your_Average_Goose 9 місяців тому

    can you make a tutorial on how to install and use ArrayV?

  •  Місяць тому

    Communist sort: returns a list with all values equal
    Step 1: have each item give all of its value to the state
    Step 2: since all values are 0 and the state is not a value, the operation is complete

  • @peepeepoopoovdbhxvbcc6683
    @peepeepoopoovdbhxvbcc6683 9 місяців тому

    Stalin sort of Stalin fed the poor o stead of starving them

  • @mgord9518
    @mgord9518 9 місяців тому +1

    I know this is intended as a joke but I'm curious if there could be an actual use case

  • @LethalChicken77
    @LethalChicken77 10 місяців тому

    That's a sorted array if I've ever seen one

  • @jennifermorrey7378
    @jennifermorrey7378 10 місяців тому

    No data, no sorting!

  • @cubefromblender
    @cubefromblender 3 місяці тому

    to simplify it, i will show a smaller list:
    2, 3, 1, 5, 4
    what stallin sort would do, is check the first number, which is 2, and do nothing
    the second number it would check if its bigger then 2, 3>2, so it gets to live
    and it repeats, and the third number is smaller then the previous number, 13, 5 gets to live
    4

  • @WarDucc
    @WarDucc 6 місяців тому +2

    ah yes the TRUE Communism.

  • @HansVanIngelgom
    @HansVanIngelgom 10 місяців тому

    The windows implementation is called Putin sort.

  • @Agodimus
    @Agodimus 10 місяців тому

    can someone expalin it lol, thats not sorting the alogrythm made every value the same?

  • @fermata4425
    @fermata4425 2 місяці тому

    Look at the list. If it's out of order, *no it isn't*

  • @redandblue1013
    @redandblue1013 10 місяців тому

    Do miracle sort next!

  • @FranRojo91
    @FranRojo91 7 місяців тому

    I see no problem here comrade

  • @baruffaparsley4710
    @baruffaparsley4710 10 місяців тому

    quickest pogromming algorithm

  • @YichenWang
    @YichenWang 10 місяців тому

    Called it!

  • @Knosek
    @Knosek 10 місяців тому +1

    Ah yes very interesting, youtube recommendations work in weird way since i don't know shit about what this video is about

  • @jericsaeyoung69
    @jericsaeyoung69 10 місяців тому

    *THE SOVIETS?!?!*

  • @guillermoelnino
    @guillermoelnino Місяць тому

    Nothing suspicious here...

  • @STATESZ
    @STATESZ 10 місяців тому

    This is the sort windows explorer uses...

  • @carlphilippgaebler5704
    @carlphilippgaebler5704 7 місяців тому

    But how many writes to gulag?

  • @user-vu8fm5vb4n
    @user-vu8fm5vb4n 8 місяців тому

    if array[n] > array[n+1]: move(&array[n], gulag)

  • @_GhostMiner
    @_GhostMiner 10 місяців тому +1

    Item that's out of place is sent to gulag 😂

  • @prosto_ivan8353
    @prosto_ivan8353 4 місяці тому

    Isn't it supposed to delet unsorted?

  • @DanDart
    @DanDart Місяць тому

    Kim sort? Or is that worse?

  • @aluxtaiwan2691
    @aluxtaiwan2691 10 місяців тому

    I thought it said Stalin snort.

  • @cringefest4999
    @cringefest4999 10 місяців тому

    So uh if you don't know what Stalin sort it... Any thing that is in the wrong place it's uh deleted

  • @Andrewforgot
    @Andrewforgot 8 місяців тому

    all data is data.

  • @FLCoeur
    @FLCoeur 2 місяці тому +1

    Xi jinping sort

  • @bored_person
    @bored_person 10 місяців тому +10

    These methods have more in common with Hitler than Stalin.

    • @calingligore
      @calingligore 10 місяців тому +2

      What makes you say that

    • @bettercalldelta
      @bettercalldelta 10 місяців тому

      both stalin and hitler were mass murderers. cope harder, tankie

    • @dwarow2508
      @dwarow2508 10 місяців тому +1

      Hitler sort would have just deleted everything and then crashed the program

  • @bekoshka3678
    @bekoshka3678 10 місяців тому +1

    reeducated those values

  • @seifenspender
    @seifenspender Місяць тому

    Wait it is exactly sorted the way I expected it to be.
    The title is a lie!

  • @pokelordomega1701
    @pokelordomega1701 10 місяців тому

    where did the small lines go

  • @mathewemad9661
    @mathewemad9661 10 місяців тому +1

    idk Why I expected a Rickroll

  • @quenbyako
    @quenbyako 10 місяців тому

    Сильно...

  • @stanczyk1167
    @stanczyk1167 5 місяців тому

    dobre xD

  • @calamorta
    @calamorta 10 місяців тому

    what is this

  • @imnotbadokbro
    @imnotbadokbro 10 місяців тому

    0.1ms sort time lol

  • @Pawlo370
    @Pawlo370 Місяць тому

    co

  • @errantwashere
    @errantwashere 10 місяців тому +7

    Errant was here

    • @priangsunath3951
      @priangsunath3951 10 місяців тому +2

      aint no way THE errant was here?11?1??!?!/!?!??!?!

  • @distendedmist5840
    @distendedmist5840 10 місяців тому +1

    I thought it was going to remove all the unsorted items

  • @matthewrease2376
    @matthewrease2376 9 місяців тому

    So...
    for (size_t i = 1; i < 1024; ++i)
    if (arr[i] < arr[i - 1])
    arr[i] = arr[i - 1];

  • @qbasic16
    @qbasic16 10 місяців тому +1

    90% ded

  • @blueninja012
    @blueninja012 10 місяців тому +1

    I don't know what happened and I'm scared

    • @Stealthfang270
      @Stealthfang270 10 місяців тому +1

      From my understanding this is a "sorting algorithm" that instead of sorting, it just deletes segments until there's only one left
      Edit: I was kinda right. It removes every element that isn't in the correct order.

  • @vk8a8
    @vk8a8 7 місяців тому

    now do the opposite. nixon sort

  • @errorhostnotfound1165
    @errorhostnotfound1165 10 місяців тому

    ...what? Why did it go from sorted to unsorted to a giant block of almost uniform size?

    • @martenkahr3365
      @martenkahr3365 10 місяців тому +1

      It deleted every element that was in the wrong order (i.e, smaller than the last intact element). Since it hit a high element very early in the sort, there were only like five elements of the initial data left by the end, all technically in the correct order.

    • @snowykoyuki
      @snowykoyuki 10 місяців тому

      sorted (initial state)
      unsorted (shuffled)
      "giant block of almost uniform size" (after stalin sort)
      the algorithm removes all elements that are smaller than the previous element (elements that are not in order are sent to gulag)

  • @erwinzer0
    @erwinzer0 2 місяці тому +1

    This is what socialists expect 😂

  • @sparr0w1
    @sparr0w1 5 місяців тому

    so fun, it's a communism sort.

  • @larrythehedgehog
    @larrythehedgehog 10 місяців тому

    This is such an obvious joke I'm surprised I'm just seeing it now.

  • @stuff7664
    @stuff7664 10 місяців тому +3

    waiting for hitler sort

  • @MatheusLB2009
    @MatheusLB2009 10 місяців тому

    False. Stalin would nullify everyone

  • @alexsander471
    @alexsander471 10 місяців тому +1

    what the hell did I just watch

  • @KozelPraiseGOELRO
    @KozelPraiseGOELRO 10 місяців тому

    Yep, I did not expect something in computation with the name of Stalin would end being WWII propaganda

  • @puckyMaXxx
    @puckyMaXxx 10 місяців тому +5

    All men are equal...(...Equally dumb I mean~😂)

    • @anthonythemortal6444
      @anthonythemortal6444 10 місяців тому +1

      Are you being sarcastic or what?

    • @RainbowGod666
      @RainbowGod666 10 місяців тому +1

      Nah thats humanity

    • @anthonythemortal6444
      @anthonythemortal6444 10 місяців тому

      @@RainbowGod666 Misanthrope be like:

    • @RainbowGod666
      @RainbowGod666 10 місяців тому

      @@anthonythemortal6444 ...kind of??? Really the dumb ones just so happen to be the guys at the top of "the food chain" and the smart ones have Golden Depression Requiem
      Depends on the worldview, really

  • @amogus6nine
    @amogus6nine 10 місяців тому

    Roblox

  • @maxim.j22
    @maxim.j22 10 місяців тому

    Что это такое?

    • @thehexagon821
      @thehexagon821  10 місяців тому +2

      Алгоритм сортировки
      Он работает, перебирая каждый элемент, и если он не отсортирован, то удаляет его из массива. Если он отсортирован, то он сохраняется.
      Пример:
      Допустим, у вас есть числа [1, 2, 3, 5, 6, 4, 7].
      Сталинская сортировка сделает массив таким:
      [1, 2, 3, 5, 6, 4, 7]
      [1, 2, 3, 6, 4, 7]
      [1, 2, 3, 4, 7]
      Удаляем 5 и 6, так как они расположены не в правильном порядке

  • @spenzr6920
    @spenzr6920 10 місяців тому

    Bro what the fuck.. i got a 21 seconds ad then i replayed the video untill i got a 5 seconds ad. Between those two events, i got 1 more 21 seconds ad and two 16 seconds ads. That doesn't even make sense

  • @apestogetherstrong341
    @apestogetherstrong341 Місяць тому

    Absolutely moronic joke based on myths.

    • @guillermoelnino
      @guillermoelnino Місяць тому

      Y ou mean funny joke based on facts.

    • @apestogetherstrong341
      @apestogetherstrong341 Місяць тому

      ​@@guillermoelnino nope, very degenerate circle-jerk humor

    • @Ursi_
      @Ursi_ 28 днів тому

      @@apestogetherstrong341this is a video about a sorting algorithm

  • @Evil_FunRuining_GayPerson
    @Evil_FunRuining_GayPerson 10 місяців тому

    Well.. that's not fun
    There was no funny. It just.. did it. Wtf. Where the beep boop beep boop ag

    • @graypalks
      @graypalks 10 місяців тому +2

      They were sent to the gulag.

    • @guillermoelnino
      @guillermoelnino Місяць тому

      Of course Y OU p eople wouldn't get it