I'm trying to work out the best approach to producing a list of valid cases, based on selections made in an arbitrary number of sections. Perhaps it's not really an algorithm, rather just advice on how to effectively iterate, but it seems like an algorithm question to me. Please correct me if I am wrong. The implementation is actually in Javascript, but it could equally apply for any language, hence the non-language-specific question.
So there are a number of sections, each having various choices, and data can be in any number of choices for each section.
If no choices are made in a section, all data is allowed through for that section. If choices are made then data must have one or more of those choices.
So for example, with:
Section: vacancy types
Choices: 1, 3
Section: exhibitor categories
Choices: 1, 5, 9
I want to come out with the following valid cases:
1,1
1,5
1,9
3,1
3,5
3,9
As I said, if no choices are made, all data should be allowed through, which is where I struggle most with working out the iteration. But also I would like a generic iteration that can be used for any number of sections, rather than just two.
I'm sure this is quite simple, and no doubt my language here is not ideal (should have listened more closely in Computer Science lessons) but how do I set up my iteration to give me the above?
I have no idea how to find the right resources to read up on this, so just a relevant link or two would be an acceptable answer, although of course I am also interested in specific answers please.
Thanks.