- Aug 15, 2000
- 12,013
- 0
- 0
Im trying to write an algorthim to do the following, but I can't seem to think it through...
Suppose you had a set of n sets like so:
ex: S = { (3,4), (1,2), (6,7) } where n=3
How would you get all the possible combos of items in the n sets?
ex: C = { (3,1,6), (3,1,7), (3,2,6), (3,2,7), (4,1,6), (4,1,7), (4,2,6), (4,2,7) }
The problem I run into when I try to think of this is if you were to write the code in lets say java, how exactly would you do this during runtime for set S of arbitrary size n?
And no, this is not homework, just part of a project im working on...
Suppose you had a set of n sets like so:
ex: S = { (3,4), (1,2), (6,7) } where n=3
How would you get all the possible combos of items in the n sets?
ex: C = { (3,1,6), (3,1,7), (3,2,6), (3,2,7), (4,1,6), (4,1,7), (4,2,6), (4,2,7) }
The problem I run into when I try to think of this is if you were to write the code in lets say java, how exactly would you do this during runtime for set S of arbitrary size n?
And no, this is not homework, just part of a project im working on...
