Thanks Mike,
I have read up a lot on permutation but I'm not completely sure that this will solve my problem. From what I can gather permutation takes a sample (i.e. ABC) and tells you how many different ways it can arrange the letters, with order mattering. What I need to do is take a variable number of groups (in my example, 3) and then display the combinations of ways that my sample (in my example, 2) can be spread across the groups.
I had a go at permutation based on your advice and while I was able to successfully find all the different combinations of ABC it did not help me in my need of dispersing the sample amongst the available groups. After I have my combinations I then need to process the data.
The example again is as follows..
A [1][2] B C A B [1][2] C A B C [1][2] A [1] B [2] C A B [1] C [2] A [1] B C [2] A [2] B [1] C A [2] C C [1] A B [2] C [1]
Think of the letters as being static amongst all possible combinations, and the numbers as the piece of data which is varying. In my actual code both fields are integers but this isn't really important here.
Does anyone have any idea how I can do the above?
Thanks so much, Michael.
Ford, Mike [LSS] wrote:
-----Original Message-----
From: Michael Benbow [mailto:[EMAIL PROTECTED] Sent: 14 June 2004 08:31
To: [EMAIL PROTECTED]
Subject: [PHP] Combo problems.. Multi Array??
Hi,
I've got a problem which has left me scratching my head for the better part of a week.
[...]
The outcome, if working properly, should be...
A [1][2] B C A B [1][2] C A B C [1][2] A [1] B [2] C A B [1] C [2] A [1] B C [2] A [2] B [1] C A [2] C C [1] A B [2] C [1]
Does anyone have any ideas on how I could do this? As I said I'm completely stumped.
This is called a permutation. Googling for "permutation formula" brings up any number of good links; the most succinct is probably http://www.mathwords.com/p/permutation_formula.htm, but most of the other top 10 links will give you the same answer with a bit (or a lot!) more explanation.
Cheers!
Mike
---------------------------------------------------------------------
Mike Ford, Electronic Information Services Adviser,
Learning Support Services, Learning & Information Services, JG125, James
Graham Building, Leeds Metropolitan University, Headingley Campus, LEEDS,
LS6 3QS, United Kingdom
Email: [EMAIL PROTECTED]
Tel: +44 113 283 2600 extn 4730 Fax: +44 113 283 3211
--
IT Co-ordinator Centre for Learning and Teaching Support Monash University
http://www.celts.monash.edu.au