-
August 19th, 2005, 02:58 PM
#1
need algorithm name
hello all.. been a few days since i visited "the forums"
need some help.
what i would like to do:
-consider an excel sheet. dealing with 5 columns.
-each column has a heading, followed by a bunch of numerical entries
-in the first column i can have 10 possible values, second, 20 possible values, 3rd 5 possible values, 4th 3, and 5th 2 poss values.
-want to write a program to generate all possible combinations of values.
question:
is there a well known algorithm to do this? if so, what is it called? if not, suggestions please.
please do not worry about hooking into excel from c++ etc yet. I have not decided yet whether i will use vba or c++. i'm just looking for an algorithm to do this. also, keep in mind that there is a large number of combinations (which will only get larger in the future- never smaller). there are many other things i have to take into account, so i'm not in the coding phase yet. i just want to see what i can get by way of algorithms so i can plan the rest of the stuff!
i seem to remember from univ courses some sort of good algorithm to do this, but i can't remember! its been a logn time!
thanks!
ps- as much as this sounds like a school assignment, it is not!!!!!!!!!!! i have been done school for a few years!
Last edited by drewdaman; August 19th, 2005 at 03:04 PM.
-
August 19th, 2005, 03:38 PM
#2
Re: need algorithm name
Don't know if there's a specific algorithm, but it isn't difficult. Just use a series of nested loops.
The outer loop would loop through the values of the first column, with successive inner loops interating the other columns.
-
August 19th, 2005, 03:53 PM
#3
Re: need algorithm name
thanks for the reply GCDEF.
yes that is true. but i was wondering what the most efficient way to do it is. i might have to do it many times and i might be dealing with a very large number of combinations.
another key thing to note is that this is not a simple truth table. The problem is that the number of possible values for each column are different. so in a normal truth table, you just have 0,1 as the possible entries for each row. here, i might have ten possible values for the entries under column 1, 20 possible values for the entries under col 2 and so on.. i guess your idea of nested loops would work, but i would need five-maybe even more- (and we thought bubble sort was bad )
-
August 19th, 2005, 05:28 PM
#4
Re: need algorithm name
10, 20, 5, 3, 2... This doesn't look to me like a the result of a simple formula (combinations, arithmetic/geomethric series, etc.)
-
August 19th, 2005, 06:00 PM
#5
Re: need algorithm name
Originally Posted by drewdaman
thanks for the reply GCDEF.
yes that is true. but i was wondering what the most efficient way to do it is. i might have to do it many times and i might be dealing with a very large number of combinations.
another key thing to note is that this is not a simple truth table. The problem is that the number of possible values for each column are different. so in a normal truth table, you just have 0,1 as the possible entries for each row. here, i might have ten possible values for the entries under column 1, 20 possible values for the entries under col 2 and so on.. i guess your idea of nested loops would work, but i would need five-maybe even more- (and we thought bubble sort was bad )
Some problems don't have an effecient solution. I believe this is one of them.
-
August 20th, 2005, 10:01 AM
#6
Re: need algorithm name
Originally Posted by cilu
10, 20, 5, 3, 2... This doesn't look to me like a the result of a simple formula (combinations, arithmetic/geomethric series, etc.)
nope.. making a small excel app (have decided now) for some cost, revenue type analysis.
[quote= GCDEF]
Some problems don't have an effecient solution. I believe this is one of them.
[quote]
i guess you're right... i will just do it that way then.
thanks for the replies guys.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|