I want to generate all the subsets of size k from a set.
eg:-say I have a set of 6 elements, I have to list all the subsets in which the cardinality of elements is 3
Here is an Iterative solution :
#include #include void printer(int locations[],int a[],int r) { int i; for(i=0; i0; i--) { if(locations[i-1]