Sunday, March 25, 2012

Algorithm to populate a table with finite value combinations

I need to populate a table which have 10 columns with four values. Each row should be a different combination of these four values and the columns can be null too. In other words how can I get all the different combinations for the 4 values that can be in 10 buckets. The final result column based on these values will be generated manually.

For example , I have for grades (P,F, WP, WF) and I have 8 terms and two exams. 8 terms and two exams can have any of the above four values. Based on these grades and terms and exams I need to generate a table which wil be used to determine the student final status Pass/Fail.

What will be the best way to do this and how is it possible. Is there a T-SQL or C# program for this.

If I need to submit this in another forum please let me know.

Do you just need some code which generates all the possible combinations? There are quite a few: 4 (scores) ^10 (exams) ~ 1M rows, without considering nulls. Do you plan to score them manually after?

You may want to rather develop some sort of scoring system (P =10,F=1, WP..., W...) and require a certain sum or average to pass

|||Yes. I am trying to get some code/algorithm to do this. The manual part will be assigning the Pass/Fail based on the combinations. Thanks.

No comments:

Post a Comment