Here is the chunk of code to find the subsets of a set:
Code:voidCode:possibleSubsets(char A[], int N) { for(int i = 0;i < (1 << N); ++i) { for(int j = 0;j < N;++j) if(i & (1 << j)) cout << A[j] << ‘ ‘; cout << endl; } }
Can anybody please explain how this program is working? I mean I am not able to understand how it will produce all the subsets of a set through this logic??
Thanks in advance.