padfoot
July 24th, 2009, 01:45 PM
I'd like to generate all subsets of a given set recursively.
For example ,
A = { 1, 2, 3 }
The subsets will be {}, { 1 }, { 2 }, { 3 }, { 1, 2 }, { 1, 3 }, { 2, 3 }, { 1, 2, 3 }
I'm having trouble coming up with a recursive way to do this.
Could someone help me out in this please ?
Thanks..
For example ,
A = { 1, 2, 3 }
The subsets will be {}, { 1 }, { 2 }, { 3 }, { 1, 2 }, { 1, 3 }, { 2, 3 }, { 1, 2, 3 }
I'm having trouble coming up with a recursive way to do this.
Could someone help me out in this please ?
Thanks..