sort.cny.shStart a race
Back to library
17 / 18Algorithm

Slowsort

Just for fun: "multiply and surrender" — a parody of divide-and-conquer.

StableIn-placeUnstable
BestΩ(n^(log n / 2))
Averagesuper-polynomial
Worstsuper-polynomial
01How it works

Recursively sort the two halves, swap so the larger of the two midpoints sits at the end, then recursively sort everything except that last element. The redundant trailing recursion is the joke — it makes the algorithm worse than O(n²) but never quite stops working.

02Best for

A textbook example of a deliberately pessimal algorithm. Useful for teaching what "divide and conquer" is by showing what its evil twin looks like.

03Avoid when

Anywhere correctness matters less than wall-clock time. It does technically sort — just astronomically slowly.