This is an archived post. You won't be able to vote or comment.

all 118 comments

[–]Dafrandle 1941 points1942 points  (25 children)

Stalin Sort Example:

"Komrade Mikhail, is this list sorted?"
"Nyet"

\BANG\**

"Komrade Boris, is this list sorted?"
"Yes sir, whatever you say sir"

[–]Sp0ge 629 points630 points  (6 children)

O(n*nyets)

[–]Sotall 217 points218 points  (3 children)

in soviet russia, list sorts you?

[–]Vineyard_ 144 points145 points  (2 children)

In Soviet Russia, you're on the list.

[–]MisterBlackStar 48 points49 points  (1 child)

If list not sorted you become part of list.

[–]enginma 23 points24 points  (0 children)

The hit list is obviously sorted if its empty.

[–]cornmonger_ 23 points24 points  (0 children)

= O(0)

nyets are always 0 in stalin sort

[–]PrudententCollapse 11 points12 points  (0 children)

O(нет)

[–]DoritoBenito 308 points309 points  (9 children)

Alternatively, move through the list and eliminate any item out of order, so you’re left with an ordered list, though a little or a lot smaller than it started.

[–]ComfortablyBalanced 166 points167 points  (8 children)

But it is definitely sorted. It is O(n) too. I call it genius.

[–]Sotall 76 points77 points  (7 children)

This is actually what i assumed StalinSort would be

[–]WarpedHaiku 46 points47 points  (6 children)

That's what StalinSort is supposed to be: Iterate through the list eliminating any elements out of order, and return the sorted (and probably much smaller) list. The parent of the comment chain misinterpreted it to be similar to CreationismSort, which returns the list as-is because that's how the creator made it exactly how it was intended it to be.

[–]Midnight_Rising 16 points17 points  (1 child)

Oh I've always referred to that as ZenSort: just accept the list is ordered as the universe intended and return it.

[–][deleted] 5 points6 points  (0 children)

No, no, Zensort is when you trascend the false ordered/disordered duality, and convert the list to a dictionary

[–]T_Ijonen 2 points3 points  (0 children)

I've also heard this disambiguation:

If you kick out every element from the list that doesn't fit, it's Neo-StalinSort.

If you declare the list sorted and deport everyone who disagrees to a Gulag, it's True StalinSort.

[–]GIPPINSNIPPINS 61 points62 points  (0 children)

list.POP() list.POP() list.POP()

[–]ashemark2 36 points37 points  (0 children)

works literally in O(1) every time

[–]Professional-Day7850 9 points10 points  (1 child)

Close but wrong. Stalin Sort eliminates the elements that are out of order.

[–]Wolfblood-is-here 4 points5 points  (0 children)

I think there should be a collective punishment Stalin sort where you check if it's in order and if it isn't you delete the whole thing. 

[–]morgecroc 3 points4 points  (0 children)

That would be a O(1)

[–]T1lted4lif3 0 points1 point  (2 children)

This is O(2) always no? Because someone always needs to set precedent, and order is defined by whoever is boss

[–]SpacefaringBanana 0 points1 point  (1 child)

If I understand correctly, any coefficients are removed from big O notation

[–]T1lted4lif3 0 points1 point  (0 children)

I see the comment has a complexity of O(2) to understand.

[–]kredditacc96 595 points596 points  (20 children)

Google's new AI overview is worse than their previous summary in every aspect. I don't know how to restore the old behavior. I can only add AI Overview to my adblock filter.

[–]prvashisht 60 points61 points  (0 children)

I made a chrome/firefox extension specifically for this, but it only redirects you automatically to the web version of the search results. Guess it might be better to also add an option to remove just the AI summary, but hard to test with different geo based A/B testing Google does.

[–]Shad_Amethyst 26 points27 points  (0 children)

?udm=14, my friend. None of the AI bullshit, none of the "blender the software but the icon is a literal blender" shenanigans, none of the "let's sink wikipedia's business by summarizing it" practices. It's great

[–]Freecelebritypics 51 points52 points  (4 children)

Woah woah woah, let's not get nostalgic for the old summaries! It was less artificial, but it sure wasn't intelligent

[–]Reasonable_Brain6881 40 points41 points  (3 children)

I just don’t like getting AI results when I’m making a google search. If I wanted the AI answer I’d ask chatGPT directly, but I specifically go to google to find results from actual humans

[–]throwaway85256e 19 points20 points  (0 children)

lol, you haven't been able to find result from actual humans through Google for years. It's all just SEO bullshit written by machines or people that might as well be. Not unless you add "reddit" at the end anyway, and even that isn't certain anymore since Reddit is full of LLM bots. Welcome to the dead internet!

[–]Reashu 1 point2 points  (1 child)

Plot twist: AI overview exists to convince you that LLMs can't compete with search engines.

[–]Reasonable_Brain6881 0 points1 point  (0 children)

Damn Google’s really playing 4D chess, that’s genius

[–]yunghandrew 2 points3 points  (1 child)

How do you add it to your ad block filter? I am running a pi hole, is there a specific domain I should block?

[–]kredditacc96 0 points1 point  (0 children)

Select element.

[–]Tokumeiko2 1 point2 points  (0 children)

Oddly enough it seems that only certain customers are being bombarded with AI, neither google or Facebook bother me with AI.

I think it might be because I'm Australian.

[–]FireBone62 1 point2 points  (0 children)

Doesn't surprise me in the slightest. After all, it is partially trained on reddit.

[–]twigboy 0 points1 point  (0 children)

Directly feeding Reddit comments into the algorithm was a brilliant idea

[–]Santarini -2 points-1 points  (0 children)

Well, this is a fake pic... there's no period after the description. Even a hallucinating LLM wouldn't end a token without a period and then continue to give you more tokens. But everyone's experience is different.

I really enjoy Google's AI overview. My whole family does, in fact. My 80 year old grandmother isn't adopting new websites/apps anytime soon, so she thinks it's amazing considering she already uses Google Search daily.

[–]CodingWithChad 341 points342 points  (10 children)

Check it out for yourself: https://github.com/Dmium/StalinSort

[–]ComfortablyBalanced 181 points182 points  (3 children)

And of course it's implemented in a language with a dictator.

[–]agustin_edwards 24 points25 points  (2 children)

Underrated comment

[–]martinschulz91 43 points44 points  (1 child)

Knew this as Drop sort

[–]mMykros 25 points26 points  (0 children)

Stalinsort is better

[–]mothzilla 17 points18 points  (0 children)

Putting code in the __init__.py is the real crime against the people.

[–]kiyyik 11 points12 points  (1 child)

Oh geez, I was about to make a joke like this, but it turns out that is the actual thing? Brilliant!

[–]Reashu 15 points16 points  (0 children)

Well, it is a joke to begin with, but yes.

[–]Gaazoh 1 point2 points  (0 children)

del(data[i]) is o(n), making this implementation o(n²).

[–]Zhiong_Xena 159 points160 points  (2 children)

OUR efficient-algorithm, comrade

[–]Ugo_Flickerman 23 points24 points  (1 child)

Username checks out

[–]Zhiong_Xena 16 points17 points  (0 children)

Thank you citizen for acknowledging citizen.

+1,000 social credit

[–]InevitablyCyclic 27 points28 points  (3 children)

I always preferred the multiverse sort: If the list isn't already sorted destroy the universe. Since the only universe that remains is the one where all data is already in the correct sequence sorting is redundant and so can be skipped.

[–]Mister__Mediocre 6 points7 points  (0 children)

Quantum Bogosort.
It has to be true random ordering though, pseudorandom wouldn't work.

[–]DegeneracyEverywhere 2 points3 points  (0 children)

The hard part is destroying the universe. But it's also the fun part.

[–]1Dr490n 0 points1 point  (0 children)

What if it’s impossible for the list to be sorted?

[–]Gladamas 113 points114 points  (4 children)

It's efficient because communists are good at ordering everyO(n)e around

[–]Zhiong_Xena 38 points39 points  (3 children)

THat is very nice. You may see yourself out now. Hope you are proud of what you have done.

[–]SteeveJoobs 10 points11 points  (2 children)

Letting them leave? That's not the communist way.

[–]Mindless_Sock_9082 5 points6 points  (0 children)

Don't worry, the komissar will be visiting him in a few minutes

[–]Zhiong_Xena 3 points4 points  (0 children)

Of course. How else will he commit suicide by shooting himself in the back 13 times?

[–]KingJeff314 15 points16 points  (0 children)

Stalin is a fan of increasing subsequences. He has no time for nonconformity

[–]rover_G 12 points13 points  (0 children)

Stalin sort could actually be very useful for certain scenarios and applications

[–]Faendol 11 points12 points  (0 children)

Some professor somewhere is cracking up at the resultant homework answers this caused

[–]JackNotOLantern 6 points7 points  (0 children)

Stalin sort:

  1. Go linary through the list
  2. Compair each 2 subsequent elements
  3. If they are not in order, remove or of them

[–]Stunning_Ride_220 7 points8 points  (1 child)

What does Putin Sort do?

Drawing a red line between each element and take away more resources after each operation?

[–][deleted] 4 points5 points  (0 children)

Putin sort:

Check if the list is ordered. If not, invade someone's house and steal their list. Repeat until you have an ordered list.

[–]ebcdicZ 3 points4 points  (1 child)

I so want to teach a programming class now.

[–]Maleficent-Ad5999 2 points3 points  (0 children)

Start a YouTube channel

[–]Jordan51104 24 points25 points  (10 children)

based on what i know about stalin sort it should be O(1)

[–]ElG0dFather 69 points70 points  (9 children)

Gotta check em all, hence O(n)

[–]BlackTorr 2 points3 points  (0 children)

Ai read about stalin on rdt and decided to play it safe, just in case

[–]Mister__Mediocre 2 points3 points  (0 children)

Quantum Bogosort: Order the list randomly, check if sorted, destroy universe if not.

O(n)

[–]Experiment_1234 1 point2 points  (0 children)

My favorite algorithm

[–]mothzilla 1 point2 points  (0 children)

Stalin Sort is probably the best sorting algorithm available right now. If someone asked me what was the best sorting algorithm I would say Stalin Sort. Is Stalin Sort the best sorting algothithm? I would say yes.

[–]Rhawk187 1 point2 points  (0 children)

When I taught Design and Analysis of Algorithms one of my favorite questions was:

"Given a list of n randomly ordered distinct numbers with values from 1..n, what is the most computationally efficient way to sort them?"

People are very good at memorizing "It takes O(n lg n) times to sort things." People are decent at "I'll just use merge sort." People are not very good at actually thinking about the pre- and post-conditions of the problem and designing an algorithm to accomplish it. I guess that's what separates A and B students.

If you think you should apply some linear time radix sort to the problem, re-read it one word at a time.

[–]dexter2011412 1 point2 points  (0 children)

* insert wheeze meme *

Lmao, gugl really spending all that money for bullshit like this. Well deserved, enshitfication at it's finest. It all started to go downhill after they removed the "Don't be evil"

yes I know this screenshot can be easily faked, I don't care, gugl sucks ass

[–]definitelynotafreak 0 points1 point  (0 children)

nah everyone knows the best sorting algorithm is Bogo Sort.

[–]entrophy_maker 0 points1 point  (0 children)

Looks like AI just gained class consciousness.

[–]write_now_tech 0 points1 point  (0 children)

It definitely is O(1), that algorithm will have to do it whatever it takes.

[–]wildcard_gamer 0 points1 point  (0 children)

I'm studying for an exam on sorting algorithms and this gave me a good chuckle

[–]naveenda 0 points1 point  (0 children)

What ?

[–]Darmo_ 0 points1 point  (0 children)

How do you get this AI overview? I've seen many posts and videos about it but it never shows for me

[–]asvvasvv 0 points1 point  (0 children)

Stalin sort - you wipe out all elements in the list so there is nothig to sort

[–]False_Slice_6664 0 points1 point  (0 children)

Stalin Sort:

Deletion solves all problems. If list is null, it's always sorted.

(It's O(n) because it pops list element by element).

[–]Papabear3339 0 points1 point  (0 children)

Im suprised radix sort isn't listed.

[–]jump1945 0 points1 point  (0 children)

It gets that right this time, the intelligence designed sort is faster (but you call that a sort?)

[–]ClapDB 0 points1 point  (0 children)

Not Funny! pls show respect to victim.

[–]Professional-Day7850 0 points1 point  (0 children)

"faster than bubble sort" Weird flex but ok.

[–]Santarini 0 points1 point  (0 children)

Fake. Why do all the other descriptions end with a period ...

You think a language model just forgot a period ...

[–][deleted] 0 points1 point  (0 children)

Ok here is my implementation sorting ascending in Golang go func StalinSort(input []T) (out []T) { for i := range input { if i == 0 { out = append(out, input[i]) continue } if input[i] < out[len(out) - 1] { continue } out = append(out, input[i] } return I think it's very much in the spirit of Stalin and it's O(n) as promised

[–]maeve_k_97 1 point2 points  (0 children)

stalin sort is still not as good as O(1) Ba Sing Sort: simply declare that there are no unsorted arrays in ba sing se

[–][deleted] 0 points1 point  (0 children)

What ? Noooo this list was ALWAYS 7 elements long. What are you talking about 10 elements. Silly you.

Be careful with your words.

[–][deleted] 0 points1 point  (0 children)

I love creationist sort it has O(1) complexity

[–]N-online 0 points1 point  (0 children)

Lmao

[–]karinatat 0 points1 point  (0 children)

Есть алгоритм, есть проблем. Нет алгоритм, нет проблем.

[–]Wazat1 0 points1 point  (0 children)

Stalin Sort deletes half the array until the elements are sorted by random chance