subset problem

please someone explain me how to subdivide a set a numbers into different sets with the help of an example.

Consider the set { 1 }. It’s subsets are { { } , { 1 } }

To find subsets of set { 1 , 2 }, add 2 to each subset of previous case => { { 2 } , { 1 , 2 } }. Add this to the set of subsets found in the previous case, i.e., { { } , { 1 } } to get { { } , { 1 } , { 2 } , { 1 , 2 } }.

Now use this to find subsets of { 1 , 2 , 3 } , then { 1 , 2 , 3 , 4 } and so on. This can be done recursively.

This question was asked in stack overflow : http://stackoverflow.com/questions/728972/finding-all-the-subsets-of-a-set

Hope it helps.

Regards,

Ouditchya Sinha.

Here I’ve explained the problem in detail.

Do upvote if you find it useful.

1 Like