Bogosort

BogoSort is a particularly ineffective algorithm one person can ever imagine. It is based on generate and test paradigm. The algorithm successively generates permutations of its input until it finds one that is sorted.

Bogo sort uses 2 steps to sort elements of the array.

  1. It throws the number randomly.
  2. Check whether the number is sorted or not.
  3. If sorted then return the sorted array.
  4. Otherwise it again generate another randomization of the numbers until the array is sorted.
while not Sorted(list):
    shuffle(list)

Time complexity: , because there are possible arrangements of the array.