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]
[stevieb]: LOL you can easily replace "Helsinki" with "Alberta"
[perldigious]: I used to live at the top of a very steep hill stevieb, I can relate to the video. Literally used to have to build up momentum and try to force my vehicle to make it up the hill to park in my driveway properly... didn't always make it.
[choroba]: Why don't they use tire chains?
[perldigious]: First snow, probably not prepared right away choroba.
[stevieb]: it's Quebec... they do weird stuff there :) In the mountains, it is *mandatory* for trucks to use tire chains. Many passenger vehicles do as well (but it's not mandatory for them)
[perldigious]: That stuff can hit fast... like what we just got where I'm at. Saw a few people who had slid OUT of the roundabout I have to drive through to get to work, not used to the ice yet, take awhile to get the hang of it again and make vehicle adjustments.
[stevieb]: man, when the roads are glare ice, I don't even bother going to work or out... unless I absolutely have to, or was already out in the first place
[choroba]: Tire chains are mandatory here in mountains, and the only unprepared each year are gritters
[stevieb]: I have a 3 day winter survival kit in my vehicle in the event I get snowed in in the mountains (which has happened before due to avalanches closing the roads (and once in the summer due to a massive forest fire that trapped us
[perldigious]: a handful of people in my work area did not make it, but I live pretty close and it's flat the whole way, so I didn't have any trouble. The roundabout is the worst thing I have to negotiate.

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (9)
As of 2016-12-06 16:36 GMT
Find Nodes?
    Voting Booth?
    On a regular basis, I'm most likely to spy upon:

    Results (112 votes). Check out past polls.