Once again I need help with a program in C... How do I make the prog output for given 'n' and 'k' all k-element subsets of set 'n'.
for example for n=3 k=2 it would write those subsets: 0,1; 0,2; 1,2 (let's think of set n as a set of natural numbers starting with 0 and ending with n-1)
There are two ways (I think) - either use of recursive functions or without recursive functions...
I would prefer the solution without use of recursion... (the ones with are welcome as well...)
How to write out all k-element subsets of n-element set in C?
binary generation or backtracking techniques
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment