I want to list permutations with only 0 and 1. Similar to binary but allowing variable lengths, doesn’t have to equal 8 length. For example:
0
1
00
01
10
11
000
001
010
011
100
101
110
111
All the way until the length of X is met. How can this be done?
I would do this as a recursive call, one function to do all of a specific length, another to call that for all relevant lengths. The following complete C# 2008 console application shows what I mean:
This outputs:
which is what I think you were after.