[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: Attn Maths gurus....array algorithm needed



PureBytes Links

Trading Reference Links

I think the thing that is at first confusing about what you ask at least to
me is that you are not looking for fixed length combinations of the Set of
numbers. When you consider it in that context it becomes much easier. You
need two loops. An outer loop to control the length of the combination. And
an inner loop to generate all the combinations of that length.


-----Original Message-----
From: c [mailto:camacazi@xxxxxxxxxxx]
Sent: Wednesday, May 05, 2004 5:21 PM
To: Omega-list@xxxxxxxxxx
Subject: Attn Maths gurus....array algorithm needed

Hi all

I need an algorithm to analyse an array.
Lets say i have an array called X and in it, it has 3 members like this
1,2,3.
i want everypossible combination of this ie

1
2
3
1,2
1,3
2,3
1,2,3

Simple? ummmmm maybe ... but my array isnt going to be a fixed length...
sometimes 2 members sometimes 10 members ie
here is the results with array called Y and it it it has 5 members 1,2,3,4,5

1
2
3
4
5
1,2
1,3
1,4
1,5
2,3
2,4
2,5
3,4
3,5
4,5
1,2,3
1,2,4
1,2,5
etc etc
up to 1,2,3,4,5

i think i may have asked something like this before ...but since then my
brain has been reformatted ...any suggestions
:O)

Cheers
Cameron
---