Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?

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]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (4)
As of 2017-12-17 06:50 GMT
Find Nodes?
    Voting Booth?
    What programming language do you hate the most?

    Results (462 votes). Check out past polls.