Search   Memberlist   Usergroups
 Page 1 of 1 [4 Posts]
Author Message
Proginoskes
science forum Guru

Joined: 29 Apr 2005
Posts: 2593

Posted: Mon Jul 03, 2006 11:26 pm    Post subject: Re: Small algorithm needed...

 Quote: I am working on a small private project in c++, and need following algorithm on the fly. I need to be able to generate a list of all possible combinations 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 = 1, with k = fixed interger,e.g 5 here. 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. It would be good if code is in C++

many links, one good one appearing to be:

http://www.scs.fsu.edu/~burkardt/cpp_src/subset/subset.html

--- Christopher Heckman
science forum beginner

Joined: 01 Feb 2006
Posts: 11

Posted: Mon Jul 03, 2006 1:48 pm    Post subject: Re: Small algorithm needed...

its like this:
In my approach to fill in the spaces, if i decide to have two ones say
1 and 1^ where 1=1^, and three zeros, then i need to generate all
permutations of these without considering the case of 101^00 and
1^0100 as two seperate cases. One shortcut is to check their decimal
val, if same as some already existing, just consider them once. Though
i was looking for a bit smarter way...
Matthias Klaey wrote:
 Quote: saad.qaisar@gmail.com wrote: I am working on a small private project in c++, and need following algorithm on the fly. I need to be able to generate a list of all possible combinations 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 = 1, with k = fixed interger,e.g 5 here. 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'm sorry this is *very* unclear. Could you please expand? What values of l and are possible? What kind of ouput do you expect if l = 345197 and t = 558191234? Greetings Matthias Kläy -- www.kcc.ch
Matthias Klaey
science forum beginner

Joined: 22 Oct 2005
Posts: 3

Posted: Mon Jul 03, 2006 12:03 am    Post subject: Re: Small algorithm needed...

 Quote: I am working on a small private project in c++, and need following algorithm on the fly. I need to be able to generate a list of all possible combinations 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 = 1, with k = fixed interger,e.g 5 here. 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'm sorry this is *very* unclear. Could you please expand? What values
of l and are possible? What kind of ouput do you expect if l = 345197
and t = 558191234?

Greetings
Matthias Kläy
--
www.kcc.ch
science forum beginner

Joined: 01 Feb 2006
Posts: 11

 Posted: Sun Jul 02, 2006 10:43 pm    Post subject: Small algorithm needed... I am working on a small private project in c++, and need following algorithm on the fly. I need to be able to generate a list of all possible combinations 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 = 1, with k = fixed interger,e.g 5 here. 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. It would be good if code is in C++ thanks

 Display posts from previous: All Posts1 Day7 Days2 Weeks1 Month3 Months6 Months1 Year Oldest FirstNewest First
 Page 1 of 1 [4 Posts]
 The time now is Tue Apr 23, 2019 12:21 pm | All times are GMT
 Jump to: Select a forum-------------------Forum index|___Science and Technology    |___Math    |   |___Research    |   |___num-analysis    |   |___Symbolic    |   |___Combinatorics    |   |___Probability    |   |   |___Prediction    |   |       |   |___Undergraduate    |   |___Recreational    |       |___Physics    |   |___Research    |   |___New Theories    |   |___Acoustics    |   |___Electromagnetics    |   |___Strings    |   |___Particle    |   |___Fusion    |   |___Relativity    |       |___Chem    |   |___Analytical    |   |___Electrochem    |   |   |___Battery    |   |       |   |___Coatings    |       |___Engineering        |___Control        |___Mechanics        |___Chemical

 Topic Author Forum Replies Last Post Similar Topics how to deduce a number validation algorithm? Tim_Mac Math 1 Fri Jul 21, 2006 10:43 am Intersection between a small and great circle christriddle@googlemail.c Math 11 Mon Jul 17, 2006 2:43 pm Small Inflatable Air Bags John Eric Voltin Mechanics 4 Fri Jul 14, 2006 3:23 pm Name of algorithm for pairwise comparison ? Paul Nutteing Math 10 Fri Jul 14, 2006 6:55 am Need an algorithm Dave111 Math 4 Fri Jul 14, 2006 2:19 am