I have a problem I'm trying to solve in Java and I cannot figure out the algorithm that I'm going to need to follow. This problem is similar to the Bit String problem (how many bit strings are there of length x), but with some added difficulty. I'm not even sure the algorithm for solving the normal bit string problem anyway.
So here's my actual problem: I have 5 variables. Say Q W X Y Z. Each variable can take one of 3 values (so like bit string can take 1 or 0, but this can take say 0, 1, or 2). I need to generate all possible combinations of this "bit string".
So one combination may be 00000 another may be 10002, another could be 22222, etc. I need to print out all combinations of this "bit string"
I'm really stumped on how to solve this problem or even come up with a decent algorithm.
Thanks for the help! Much appreciated.