Bogo-Sort Algorithm: A Study in Inefficiency

The Bogo-Sort algorithm is a notoriously inefficient sorting algorithm that is often cited as an example of a bad algorithm.

Here's a simple implementation in Python:

def bogo_sort(lst):
			while True:
				random.shuffle(lst)
				if lst == sorted(lst):
					return lst
		

This algorithm is so slow that it will sort a list of 10 random integers in about 10^20 years.

Learn more about the Bogo-Sort algorithm.

Back to Algorithm Index