Permutations with repatitions in c++

R

Roger

Hello,

I am working on a small private project in c++. For the program
however, I need to be able to generate a list of all possible
combonations for a set of numbers. k = amount of spaces
t = highest number
l = lowest number

I need a function that will give all possible combonations of k spaces
with numbers from l to t ex. l = 0 , t = 2, with k = 5.

00000, 00010, --snip-- , 11111
so numbers will be able to repeat them selves.

Like I said before I need ALL POSSIBLE COMBANATIONS and no repeateing
combanations in the list.

I have worked on this for a while to no avial. Any ideas, code
examples, or direction
 
M

Martin Magnusson

Roger said:
I need a function that will give all possible combonations of k spaces
with numbers from l to t ex. l = 0 , t = 2, with k = 5.

This is much more of a combinatorial problem than a C++ related one. You
will probably be able to get more help at comp.math or a similar group.
Actually, I think there is something related to this in the comp.math
FAQs. http://www.faqs.org/ might be of help.

/ martin
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,774
Messages
2,569,596
Members
45,135
Latest member
VeronaShap
Top