Enumerating Groups - Algorithm
Suppose I have 6 items, and I want to choose 3 from them. I want to enumerate them all in some order.
Obviously I can do this by hand very easily:
ABC
ABD
ABE
ABF
ACD
ACE
ACF
ADE
ADF
AEF
BCD
BCE
BCF
BDE
BDF
BEF
CDE
CDF
CEF
DEF
But suppose I wanted to programatically generate the nth combination? Any easy way to do this?
Group(5) = ACD for this enumeration. I don't care what enumeration is used, as long as it is a proper enumeration.
|