**Objective: **Given a set of numbers, print all the posssible subsets of it including empty set.

Power Set: In mathematics, PowerSet of any given set S, PS(S) is set of all subsets of S including empty set.

**Example**:

S ={1,2,3} PS(S): {{ᵩ}, {1}, {2}, {3}, {1,2}, {1,3}, {2,3}, {1,2,3}}.

**Approach:**

**Solution to this problem is similar to – Print All Combinations of subset of size K from Given Array**

- Create an binary array of the same size as the given array.
- Now for every integer we have two options, whether to select it or ignore it.
- Now if we select it, we will put
**1**in the boolean array at the corresponding index or if we ignore it, put**0**at that index. - Say you have a variable called
, which represents the current index at the given array.*x* - Make
and*x = 0 ( ignoring xth index)*and make*x = 1( selecting xth index)**recursive*

**Code:**

**Output**:

{Empty} {3} {2} {23} {1} {13} {12} {123}

this post has very good explanation http://javabypatel.blogspot.in/2015/10/all-subsets-of-set-powerset.html