Beefy Boxes and Bandwidth Generously Provided by pair Networks
Come for the quick hacks, stay for the epiphanies.
 
PerlMonks  

Re^3: Efficient Unique Nested Combinations

by Moron (Curate)
on Jun 27, 2007 at 09:32 UTC ( [id://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!

Replies are listed 'Best First'.
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
Domain Nodelet?
Node Status?
node history
Node Type: note [id://623566]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others cooling their heels in the Monastery: (4)
As of 2024-03-28 22:44 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found