M
markredd
Hello world,
I'm looking for an algorithm in order to perform this operation: I
have a set of N possible values and I want to generate all the
possibile permutations composed by M slots without repetitions and not
considering the order.
Note: I don't know what are the values of N and M befor the software
starts, so i have to implement it at run-time.
For example, if N=4 with values {1 , 2 , 3 , 4} and M=3, I will obtain
only 4 combinations, for example:
(1,2,3) [or (3,2,1), or (2,1,3), the order doesn't matter]
(1,3,4)
(1,2,4)
(2,3,4)
Can you describe an algorithm? (I don't need code, I hope I will able
to develop it!)
thanks
I'm looking for an algorithm in order to perform this operation: I
have a set of N possible values and I want to generate all the
possibile permutations composed by M slots without repetitions and not
considering the order.
Note: I don't know what are the values of N and M befor the software
starts, so i have to implement it at run-time.
For example, if N=4 with values {1 , 2 , 3 , 4} and M=3, I will obtain
only 4 combinations, for example:
(1,2,3) [or (3,2,1), or (2,1,3), the order doesn't matter]
(1,3,4)
(1,2,4)
(2,3,4)
Can you describe an algorithm? (I don't need code, I hope I will able
to develop it!)
thanks