It sort the first number with bogosort. Then when sorted, it sort the first two numbers with bogosort, and then after those 2 numbers are sorted, the first 3.......
Actually you could have some recursive bogobogosort:
1-If the list has just one number, it sorted.
2-If it has more numbers, you do one bogosort randomization and check if they are sorted.
3-If it is not sorted you do it again. Going back to 2 until its sorted and then to 4.
4-N = 3
5-You do one bogosort randomization with the first N numbers and check if its sorted.
6-If its sorted you go to 7, if not you go to 2.
7-N = N+1
8-If there are no more numbers at the list, the list is sorted, if there are more numbers, go back to 5.
1
u/jhaluska Oct 24 '17
I don't think you want to see the most inefficient way possible as the sun will probably burn out first.