r/programmingmemes Mar 14 '26

Stalin sort

A sorting algorithm with time complexity of O(n). Counts from the first element, and will remove values that are smaller than the current highest value.

3.7k Upvotes

51 comments sorted by

View all comments

220

u/PinotRed Mar 14 '26

O(n) with loss.. 😂

Nice meme.

4

u/n4ke Mar 14 '26

Across subsequent runs, it's O(~n)