View Single Post
  #1  
Old 12-01-2005, 05:46 PM
TomCollins TomCollins is offline
Senior Member
 
Join Date: Jul 2003
Location: Austin, TX
Posts: 172
Default 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.
Reply With Quote