المساعد الشخصي الرقمي

مشاهدة النسخة كاملة : Find Unique Combination Numbers from a pool list (combinations and permutations)



C++ Programming
04-02-2009, 04:51 PM
Hi,

I want from a list let's say A={1,2,3,4} with N elements, 4 in our case , to find the unique combinations for groups of K, where K=2,3...N

For example if N=4 and K=2 then the correct algorithm should output the following results

(1,2)
(1,3)
(1,4)
(2,3)
(2,4)
(3,4)

if N=4 and K=3 then it should output

(1,2,3)
(1,2,4)
(1,3,4)
(2,3,4)

and if N=4 and K=4 then

(1,2,3,4)

Can someone help me to do this without using STL Library ?

Regards

sdancer75