Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re^3: Efficient Unique Nested Combinations

by Moron (Curate)
on Jun 27, 2007 at 09:32 UTC ( #623566=note: print w/ replies, xml ) Need Help??


in reply to Re^2: Efficient Unique Nested Combinations
in thread Efficient Unique Nested Combinations

Au contraire, M::C supports nCk and the described operation can be expressed as a two-deep explicit nested loop of nCk next-combination calls, the lower layer being nC1.

Update: because selecting a single member from a set is the semi-degenerate nC1 case of an nCr.

__________________________________________________________________________________

^M Free your mind!


Comment on Re^3: Efficient Unique Nested Combinations
Re^4: Efficient Unique Nested Combinations
by Roy Johnson (Monsignor) on Jun 27, 2007 at 15:17 UTC
    If I understand you — and I very well may not — you'd be generating the whole set and then letting M::C filter it down. Can you illustrate what you're talking about, in Perl?

    Caution: Contents may have been coded under pressure.
      No I meant to just iterate nested next-combinations but it comes to my attention that actually both loops were degenerate (nCn and nC1) so that M::C would be doing nothing more than returning next elements in arrays, which might as well be handrolled anyway. To assure unique selections from inner arrays, the OPs hash idea seems now as good as any.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (18)
As of 2014-07-31 14:03 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (249 votes), past polls