Probablity algorithm for N choose M in C or C++

Status
Not open for further replies.

kappajacko

Newbie level 3
Joined
Dec 16, 2006
Messages
4
Helped
11
Reputation
22
Reaction score
11
Trophy points
1,283
Activity points
1,301
Does anyone have an algorithm that creates all the possiblities an N choose M.


i.e. given a set of a b c d; 4 choose 2 gives me:

ab
ac
ad
bc
bd
cd

I can't seem to get this. I was trying to use recursion, but I can't see it...
 

Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…