JavaScript is required for this website. Please allow JavaScript and refresh the page.
home Home
sort Sorts
LOGARITHMIC
Quick Sort Merge Sort Heap Sort
QUADRATIC
Bubble Sort Selection Sort Insertion Sort Gnome Sort Shaker Sort Odd Even Sort Pancake Sort
WEIRD
Bitonic Sort Radix Sort Shell Sort Comb Sort Bogo Sort Stooge Sort
CUSTOM
Your Sort
SORT VISUALIZER
Stooge Sort
Elements: 100
DESCRIPTION

Stooge Sort is a recursive sorting algorithm, known for its terrible time complexity. It is based on comparisons.

The algorithm first checks the first element of the data structure and the last, swapping them if they are in the wrong order. If there are more than 3 elements, it calls itself recursively on the initial 2/3 of the list, on the final 2/3 of the list and again on the initial 2/3 of the list, until all the list is sorted.

Its complexity is almost cubic, making it worse than Selection Sort or Insertion Sort.

COMPLEXITY
Average Complexity O(nlog 3 / log 1.5)
O(n2.7095...)
Best Case O(nlog 3 / log 1.5)
O(n2.7095...)
Worst Case O(nlog 3 / log 1.5)
O(n2.7095...)
Space Complexity O(n)