If I have an array of boolean values of n length, how can I iterate over all possible permutations of the array?
For example, for an array of size 3, there are eight possible permutations:
[0,0,0]
[0,0,1]
[0,1,0]
[0,1,1]
[1,0,0]
[1,0,1]
[1,1,0]
[1,1,1]
P.S. I am working in C, although I'm not necessarily looking for a language specific answer. Just trying to find an efficient algorithm to do this with large arrays and many possible permutations.