Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re: How can one generate all possible permutations of r elements out of n where r<n?

by space_monk (Chaplain)
on Feb 26, 2013 at 13:44 UTC ( #1020692=note: print w/ replies, xml ) Need Help??


in reply to How can one generate all possible permutations of r elements out of n where r<n?

A very fast look on CPAN reveals Math::Combinatorics

Despite the low version number, it looks as though it does what you want, and if it doesn't the source code is probably a good starting point to modify to do it.

IIRC a lot of advice round here advises Googling and checking CPAN, because it's probably been asked before :-).

A Monk aims to give answers to those who have none, and to learn from those who know more.


Comment on Re: How can one generate all possible permutations of r elements out of n where r<n?
Re^2: How can one generate all possible permutations of r elements out of n where r<n?
by supriyoch_2008 (Scribe) on Feb 27, 2013 at 09:14 UTC

    Hi space_monk,

    Thanks for the suggestions. I have used Math::Combinatorics to solve the problem of combinations of elements.

    With kind regards.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1020692]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (11)
As of 2014-12-27 17:19 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (177 votes), past polls