Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

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

by LanX (Sage)
on Sep 18, 2020 at 13:50 UTC ( #11121920=note: print w/replies, xml ) Need Help??


in reply to Re: Generate all unique combinations of 1 and 0 using specified length of "0"-string and count of 1's [Updated]
in thread Generate all unique combinations of 1 and 0 using specified length of "0"-string and count of 1's

> sub Eily_LanX

I'm not sure how I should take merits for Eily's work ... But thanks. :)

My goal was simplicity, if it was about speed I might provide an other approach plus case optimization. (Like inverting to the dual case if more than half of the bits are ones)

The output format should be clarified though. String, bit vector, array...?

Cheers Rolf
(addicted to the Perl Programming Language :)
Wikisyntax for the Monastery

) oh I see Re^2: Generate all unique combinations of 1 and 0 using specified length of "0"-string and count of 1's

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

Replies are listed 'Best First'.
Re^3: Generate all unique combinations of 1 and 0 using specified length of "0"-string and count of 1's [Updated]
by Eily (Monsignor) on Sep 18, 2020 at 19:45 UTC

    I mentioned your post because reading your it made me think "oh right, using substr is probably more efficient than changing then joining an array". Although it's not really the generalisation of your code. Also it let me make the Perlmonks::Combinatorics joke 😁

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (5)
As of 2022-12-09 01:53 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?