0

I have

List1 = {A,B}
List2 = {C,D}
List3 = {E,F}
List4 = {G,H}

A program will print a final list composed by only one letter from each list. So one of the combination can be {A,C,E,G}.

How many combination are possible? What is the formula to count the number of the combinations?

1 Answers1

1

In your case, there are $16 = 2^4$ combinations. More generally the formula is $M^N$ for $M$ elements in each list and $N$ lists.

Brick
  • 1,345
  • 1
    You are assuming the lists are disjoint. – Gerry Myerson Aug 24 '15 at 12:59
  • @GerryMyerson The OP said he's going to pick one from each list. He didn't say that there couldn't be repetitions in the result, i.e. if List1 = {A,B} and List2 = {B,C}, I read his requirement to mean that {B,B} is a valid outcome. (His use of curly braces here doesn't seem to imply a mathematical set.) If he meant something different, then of course you'd need to account for "disjointedness" in the count. – Brick Sep 14 '15 at 22:06