Definitely row by row, they are subsets.
http://stackoverflow.com/questions/1851134/generate-all-binary-strings-of-length-n-with-k-bits-set
We need 2 variables for this. 1) A string of 0's and 1's (the binary number) and 2) keep track of position of current bit we are working with, current bit position will start at index 0 (right most)
We want to start with 0 0 1 for this algorithm to work.
Step 1) if current bit is unset we set it, else we unset all bits goto step 2, then return to step 1.
Step 2) shift current index to the left
Step 3) if current index is > size break, else set the bit
Step 4) shift current index to the right most bit
Step 5) Go to step 1
(May be a few flaws in the steps but sounds right to me)
Step 1) if current bit is not set goto step 7
Step 2) unset all bits
Step 3) shift current index left
Step 4) if current index > size goto Z, else set current index
Step 5) shift current index to rightmost bit
Step 6) goto step 1
Step 7) set current bit
Step 8) shift current index left
Step 9) if current index is <= size goto step 1, else break
May still have a few logic problems but I am in a hurry sorry.