A
andrews
I am searching for a good algorithm for generating combinations.
F.e.
I give the arguments n and m where m and n are integers and m < n.
Takes as example n = 5 and m = 3.
The program gives the results
123
124
125
134
135
145
234
235
245
345
The ordering of the three elements is not important and there are
n!/(n-m)!m! possibilities
I can to that with
for
for
for
for
....
next
next
next
next
.....
but this is to long and to complicated when n is big
Thanks for any response
F.e.
I give the arguments n and m where m and n are integers and m < n.
Takes as example n = 5 and m = 3.
The program gives the results
123
124
125
134
135
145
234
235
245
345
The ordering of the three elements is not important and there are
n!/(n-m)!m! possibilities
I can to that with
for
for
for
for
....
next
next
next
next
.....
but this is to long and to complicated when n is big
Thanks for any response