[RESOLVED] Two Dimensional ArrayList and finding combinations Questions
Ok here is what i want to do.
I have a one dimensional arraylist holding 100 numbers that are all unique. i would like to loop through all those numbers and group them into sets of 5 which would leave me 20 groups.
but here is the catch, no group can contain the same number twice and each group has to be unique when compared to the other groups.
each group can contain four of the same numbers of another group but not 5.
like so
key 0 --- value(100,200,500,1000,20)
key 1 -- value(200,999,100,1000,20)
key 2 ----value(500,999,100,80,50)
basically i need to find every possible combination for each group. a matrix if you will.
how can achieve this? using a recursive function with indexof?
ArrayList MainArray = new ArrayList();
MainArray.Add(new ArrayList());
MainArray.Add(new ArrayList());
(MainArray[1] as ArrayList).Add("Hello");
(MainArray[1] as ArrayList).Add("Hello2");
(MainArray[2] as ArrayList).Add("***");
Console.WriteLine(" hello item" + MainArray.IndexOf("***") +"does not exist");
Re: Two Dimensional ArrayList and finding combinations Questions
found a solution to my problem
Permutations, Combinations, Variations and lots of reading. Probably going with LINQ solution.
this helped me get on the right track.
http://www.codeguru.com/cpp/cpp/algo...icle.php/c5117