Anonymous user
Sorting algorithms/Permutation sort: Difference between revisions
Sorting algorithms/Permutation sort (view source)
Revision as of 14:25, 24 March 2011
, 13 years ago→{{header|Groovy}}
Line 433:
=={{header|Groovy}}==
Permutation sort is an astonishingly inefficient sort algorithm. To even begin to make it tractable, we need to be able to create enumerated permutations on the fly, rather than relying on [[Groovy]]'s ''List.permutations()'' method. For a list of length ''N'' there are ''N!'' permutations. In this solution, ''makePermutation'' creates the ''I<sup>th</sup>'' permutation to order based on a recursive construction of a unique
I believe that this method of constructing permutations results in a stable sort, but I have not actually proven that assertion.
|