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
Find a working code below
#include #include #include using namespace std; void print( list l){ for(list::iterator it=l.begin(); it!=l.end() ; ++it) cout << " " << *it; cout< &l){ if(left==0){ print(l); return; } for(int i=index; i lt; subset(array,5,3,0,lt); return 0; }