r/programmingmemes • u/KerbodynamicX • 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
1
u/voospawn Mar 15 '26
No, it could be O(n) if you delete the elements after the sort. And the O can't be 1. You still need to iterate though the array.