I tied to simplify the task as much as possible, so I could apply it to my algorithm.
And here is the challenge for mathematicians and programmers:
I need to
Here's a simple version implemented using recursion
public void optionality_generator(int n){
ArrayList strings = generatorHelper(n);
for(String s : strings){
System.out.println(s);
}
}
private ArrayList generatorHelper(int n){
if(n == 1){
ArrayList returnVal = new ArrayList();
returnVal.add("0");
returnVal.add("X");
return returnVal;
}
ArrayList trueStrings = generatorHelper(n-1);
for(String s : trueStrings){
s += "0";
}
ArrayList falseStrings = generatorHelper(n-1);
for(String s : falseStrings){
s += "X";
}
trueStrings.addAll(falseStrings);
return trueStrings;
}