Utterly useless yet fun sorting algorithms

Sorting algorithms have always been one of the pillars of algorithmic studies. The idea is simple: you have a list of items, and you want them in order. Over the years we've invented elegant ways to do that - quicksort, mergesort, heapsort etc. All carefully analysed with Big-O complexity: O(1), O(n log n), O(n²), and so on.

But there's another complexity class they never really talk about: O(Oh-No). So I built a small open-source repo - a lovingly curated collection of utterly useless sorting algorithms, each with its own personality. Nine algorithms and counting.

Inside, you'll find gems such as:

1/ Bogo Sort - shuffles the list randomly and checks if it's sorted. Repeats until it works or the heat death of the universe, whichever comes first.

2/ Darwin Sort - permutations compete for survival across generations using actual genetic algorithms. Most go extinct. Some converge. Convergence is not guaranteed.

3/ Digit Sort - sorts by number of digits, not value. 9 comes before 10. 100 comes after 99. Technically correct by its own rules, which are wrong.

4/ Urinal Sort - numbers pick positions the way people pick urinals: maximum distance from anyone already there. An awkwardness parameter controls how badly it goes.

5/ Vibe Sort - sends the list to an AI agent and asks it to sort by vibes. In --pro mode, a coding agent writes a sorting function and executes it. Like a pro. No API key? The algorithm panics, shuffles randomly, and picks an excuse from a curated list of coping mechanisms.

Some lose data. Some take forever. Some ask an AI to do it and ship whatever comes back. All are completely useless, yet fun.

Want to try?

pip install big-oh-no

big-oh-no --help

Contributions are very welcome. Found another impractical sorting algorithm? Want to make an existing one worse, funnier, or more dramatic? Raise a PR.

Three rules:

a/ It must actually sort a list of numbers.

b/ It must run from the CLI.

c/ The algorithm must either be completely useless, have a strong personality, or preferably both. It must sort, potentially with side effects.

submitted by /u/Sufficient_Source925
[link] [comments]