Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re^2: Generate all unique combinations of 1 and 0 using specified length of "0"-string and count of 1's [Updated]

by Tux (Canon)
on Sep 18, 2020 at 12:46 UTC ( #11121919=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    use Algorithm::FastPermute;
    
    ...
            oct "0b$s1" .. oct "0b$s1$s0"
            ];
        }
    
  2. or download this
    sub tux_recur {
        my ($length, $ones) = @_;
    ...
          ( map { "1$_" } @{tux_recur ($length - 1, $ones - 1)} ),
          ];
        }
    
  3. or download this
    Discipulus  0.103/s
    tux_a_fp     1.43/s
    ...
    salva        4187/s
    Eily_LanX    5110/s
    GrandFather  6119/s
    

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (5)
As of 2022-12-03 19:18 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?