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

Bogo Sort (also called Stupid Sort) is an iterative sorting algorithm particularly inefficient. It's based on randomly shufflying the elements of the data structure and then checking if they are correctly sorted. If not, repeat the process.

It is a probabilistic algorithm. The amount of possible permutations of a data structure of n elements is n!, so it will take on average n! shuffles to reach the solution. Each shuffle takes n operations, so the total average number of operations is n × n!

Since its performances depend entirely on probability, the worst case complexity is not measurable.

Average Complexity O(n × n!)
Best Case O(n)
Worst Case
Space Complexity O(1)