in reply to Re: Challenge: Generate fixed size combination across groups without duplicates
in thread Challenge: Generate fixed size combination across groups without duplicates
JavaFan,
Well, that only works for the sample provided and not the larger problem of a variable number of groups but it is trivial to extend it to the general case. I simply need to reverse the solution I provided in the original problem description:
Well, that only works for the sample provided and not the larger problem of a variable number of groups but it is trivial to extend it to the general case. I simply need to reverse the solution I provided in the original problem description:
- Use any fixed size combination iterator to produce the combination of groups matching the fixed size target
- Use Algorithm::Loops or similar to generate the cartesian product
This is also much simpler than the odometer model solution I came up with last night after posting this. Thanks.
Cheers - L~R
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^3: Challenge: Generate fixed size combination across groups without duplicates
by Util (Priest) on Nov 17, 2011 at 02:56 UTC | |
by ikegami (Patriarch) on Nov 17, 2011 at 10:14 UTC | |
by Anonymous Monk on Dec 11, 2012 at 11:39 UTC |
In Section
Seekers of Perl Wisdom