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.
- It throws the number randomly.
- Check whether the number is sorted or not.
- If sorted then return the sorted array.
- Otherwise it again generate another randomization of the numbers until the array is sorted.
Time complexity: , because there are possible arrangements of the array.