That ... might work. Although if I try to follow it I go from ACE -> ADE -> BDE and I don't quite get to BCE, but I might have done something wrong.

Just to be lazy, I grabbed Johnsonbaugh off the shelf. His pseudocode is a little more verbose than I remember it being (but I suppose that's okay), and you're working on a mirror image of it. His version (from page 244 ofDiscrete Mathematics):

Code:combination(r, n) { for i = 1 to r s[i] = i print(s[1], ..., s[r]); for i = 2 to C(n,r) { m = r max_val = n while (s[m] == max_val) { // find the rightmost element not at its maximum value m = m-1 max_val = max_val - 1 } //the rightmost element is incremented s[m] = s[m] + 1 // the rest of the elements are the successors of s[m] for j = m+1 to r s[j] = s[j-1] + 1 print(s[1], ..., s[r]) } }