Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Iterate through non-empty proper subsets. Doesn't include mask
- for(int a = (mask - 1) & mask; a ; a = (a - 1) & mask){
- printf("%d is a non-empty proper subset of %d", a,n);
- }
- // Iterate through all subsets
- for(int a = mask; true ; a = (a - 1) & mask){
- printf("%d is a subset of %d", a,n);
- if(a == 0) break;
- }
Add Comment
Please, Sign In to add comment