random sort

created by WolfKeeper
(idea) by WolfKeeper (4.3 wk) (print)   (I like it!) Thu Sep 19 2002 at 10:55:37
Random Sort is a way of sorting a list in O((n-1)! n^2) time.

The algorithm is simple:

1. Randomly order the list.

2. Check if it is sorted.

3. If not, return to step 1.

It certainly has impressive performance for large n. In practice it works well for n up to about 6, and slows considerably after this point. For large n better sorts are recommended, such as bubble sort ;-).

Y'know, if you log in, you can write something here, or contact authors directly on the site. Create a New User if you don't already have an account.