Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

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

by BrowserUk (Pope)
on Feb 26, 2013 at 12:29 UTC ( #1020679=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?

C:\test>perl -MAlgorithm::Combinatorics=variations -E"$i=variations( [ +'A'..'D'], 3 ); say @$_ while $_= $i->next" ABC ABD ACB ACD ADB ADC BAC BAD BCA BCD BDA BDC CAB CAD CBA CBD CDA CDB DAB DAC DBA DBC DCA DCB

With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.


Comment on Re: How can one generate all possible permutations of r elements out of n where r<n?
Download Code
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:11 UTC

    Hi BrowserUK,

    Thank you very much for the code. But I am sorry that I do not understand the code as it does not start with #!/usr/bin/perl, the code I am a little acquainted with.

    With regards.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (8)
As of 2014-09-01 23:02 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite cookbook is:










    Results (18 votes), past polls