Algorithm for subsets

Ok, this seems easy, but I’ve been doing HW for too long and my brain needs a jump start. What better place to get an intellectual boost than the SDMB? Anyway, does anyone happen to know (or know of a link to a site that knows) an algorithm for generating all of the subsets of a given finite set? Thanks…

You could try it this way: If there are n elements in the set, there are going to be 2[sup]n[/sup] subsets and each subset is going to correspond to a binary number. So put the elements in some order and all of the binary numbers from 0 to 2[sup]n[/sup]-1 underneath them in columns. Each binary number corresponds to a subset, where a “1” means include the element, “0” means exclude it. For example, with the set (a,b,c}:

a b c

0 0 0 empty set
0 0 1 c
0 1 0 b
0 1 1 b,c
1 0 0 a
1 0 1 a,c
1 1 0 a,b
1 1 1 a,b,c