generate all subsets of size k from a set

Posted by Kumar on Stack Overflow See other posts from Stack Overflow or by Kumar
Published on 2010-12-29T15:51:24Z Indexed on 2010/12/29 15:53 UTC
Read the original article Hit count: 223

Filed under:
|

hi,

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. I tried looking for solution,but those are code snippets. Its been long since I have done coding,so I find it hard to understand the code and construct a executable program around it. A complete executable program in C or C++ will be quite helpful. Hoping of an optimal solution using recursion. Thanks in advance. Kumar.

© Stack Overflow or respective owner

Related posts about c++

Related posts about c