This is an algorithm to compete with the current slowest sorting algorithms.
1. We're given our list to sort, L
2. Create a list of length 0, M
3. Randomly, either append a random* value to the end of M, or remove the last value. If M has length 0 then we do not remove the last non-existent value.
4. Check if all elements of M are in L.**
5. If yes, check if all elements of L are in M.
6. If yes, check if M is in order.***
7. If no, repeat from Step 3. If yes, we've sorted it.
* this could be problematic.
if it's an int of size 32 for example, we can just add a number from -2^31 to 2^31-1.
if it's a float, we could do something similar for the 80-bit or 64-bit floating point value.
if it's a bignum, we can apply step 3 to the number itself as a string of digits.
if it's a string, we could also apply step 3 here.
if it's some arbitrary object, we can randomize every primitive type it's composed of in the above manners
** something like:
for x in M:
if not x in L:
it's in there.
and vice versa for Line 5.
*** something like:
M += [+inf]
for i in 0...len(M):
if M[i] > M[i+1]: