Even more ineffective / less effective!
- Gorosort
- is a sorting algorithm introduced in the 2011 Google Code Jam. As long as the list is not in order, a subset of all elements is randomly permuted. If this subset is optimally chosen each time this is performed, the expected value of the total number of times this operation needs to be done is equal to the number of misplaced elements.
- Bogobogosort
- is an algorithm that was designed not to succeed before the heat death of the universe on any sizable list. It works by implementing the bogosort on the first two elements in the list. If they are in order, then it bogosorts the first three elements, and so on, increasing by one until the entire list is sorted. Should the list not be in order at any point, the sort starts over with the first two elements.
- Bozosort
- is another sorting algorithm based on random numbers. If the list is not in order, it picks two items at random and swaps them, then checks to see if the list is sorted. The running time analysis of a bozosort is more difficult, but some estimates are found in H. Gruber's analysis of "perversely awful" randomized sorting algorithms. O(n!) is found to be the expected average case.
- Quantum Bogosort
- An in-joke among some computer scientists is that quantum computing could be used to effectively implement a bogosort with a time complexity of O(n). First, use quantum randomness to permute the list. The quantum randomization creates n! branches of the wavefunction ("universes" in many-worlds interpretation), and one of these will be such that this single shuffle had produced the list in sorted order. The list is then inspected, and if it is not sorted, the universe is destroyed. Since destroyed universes cannot be observed, the list is always observed to have been successfully sorted after one iteration in O(n) which is just the time needed to verify that the list is sorted.
No comments:
Post a Comment