output subsets

Started by
0 comments, last by g_wei 23 years, 1 month ago
How can I ouput a set''s all subsets using recursive of C/C++? e.g: [a,b,c]=>[null],Link
Advertisement
Do you need to do it recursively? It''s probably easier iteratively.
One way is to create a counter with as many bits as elements, and step through all possibilities in that counter, outputing the elements (each bit in the counter refers to a single element, if the bit is 1, output the element).
Gee Brain, what we gonna do tonight?

This topic is closed to new replies.

Advertisement