$CBAS has asked for the wisdom of the Perl Monks concerning the following question:
Hi,
This question is not Perl-specific but Perl is the language I love implementing things in because it gets 'em done! Hopefully it won't let me down this time.
I'm looking for a way to cycle through all unique orderings of an array. I feel like there's a trick to do this but I just can't find it!
Say I have an array [$a, $b, $c, $d, $e, $f], what would be the fastest or easiest way to loop through every possible way this array can be sorted?
The arrays I would be using are not fixed in length, so the number of possible orderings will be HUGE and hard coding the loop(s) is NOT an option :-(
Thank you for your time, I'll give it back someday :-)
CBAS
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Uniquely sorting arrays
by arturo (Vicar) on Mar 07, 2001 at 19:52 UTC | |
|
Re: Uniquely sorting arrays
by Corion (Patriarch) on Mar 07, 2001 at 19:54 UTC | |
by tye (Sage) on Mar 07, 2001 at 23:18 UTC | |
by $CBAS (Scribe) on Mar 07, 2001 at 23:48 UTC | |
|
Re: Uniquely sorting arrays
by jeroenes (Priest) on Mar 07, 2001 at 19:56 UTC |