Slow Sort
Definition
Slow Sort is a humorous sorting algorithm designed to be as slow as possible while remaining correct. It is based on the multiply-and-surrender paradigm (a play on the divide-and-conquer strategy).
It is a highly inefficient recursive algorithm that divides the array into halves, recursively sorts them, compares the last elements of the two halves to place the maximum element at the end, and then recursively sorts the remaining array.
Characteristics
- Multiply-and-Surrender:
- The algorithm recursively calls itself three times, sub-optimally dividing the work and dragging execution out unnecessarily.
- In-Place:
- It sorts the input array in-place, relying on index ranges during recursion.
- Dreadfully Slow:
- Its time complexity is worse than polynomial, meaning that sorting even a tiny array takes a substantial number of operations.
Complexity Analysis
- Time Complexity:
- Worst Case: — The recurrence relation is: This recurrence yields an execution profile that is extremely slow and worse than any polynomial time.
- Space Complexity: — Required due to the deep recursion call stack.
Implementations
Here are the recursive implementations of Slow Sort in various programming languages: