Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight

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

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?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://623566]
[Corion]: Meh ... Minion really doesn't want to run under the fork() emulation on Windows (which I understand), but has no other way either (which I find inconvenient)
[Corion]: Other than that, it seems really polished

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (5)
As of 2018-06-21 15:01 GMT
Find Nodes?
    Voting Booth?
    Should cpanminus be part of the standard Perl release?

    Results (118 votes). Check out past polls.