I need to write a fox prog to display every possible combination of stored records in a table possible. The trick is to show every combination without duplicating or missing combinations.
for example:
Cursor BOB
Rec1 A
Rec2 B
Rec3 C
Rec4 D
The result should be 15 combinations (I think!) they can be in any order)
AB counts the same as BA and so does not count as a combination. Also there could be any number of Records (so I expect the code to run slowly)
An example of the results
Combi 1 A
Combi 2 AB
Combi 3 ABC
Combi 4 A C
Combi 5 ABCD
Combi 6 AB D
Combi 7 A CD
Combi 8 A D
Combi 9 B
Combi 10 BC
Combi 11 B D
Combi 12 BCD
Combi 13 C
Combi 14 CD
Combi 15 D
I've tried writting a program using recursion but, it keeps missing out "AB D" DOH!
This is a real brain teaser (or Head F**K), so any help would be appreciated.
Cheers
Glyn
for example:
Cursor BOB
Rec1 A
Rec2 B
Rec3 C
Rec4 D
The result should be 15 combinations (I think!) they can be in any order)
AB counts the same as BA and so does not count as a combination. Also there could be any number of Records (so I expect the code to run slowly)
An example of the results
Combi 1 A
Combi 2 AB
Combi 3 ABC
Combi 4 A C
Combi 5 ABCD
Combi 6 AB D
Combi 7 A CD
Combi 8 A D
Combi 9 B
Combi 10 BC
Combi 11 B D
Combi 12 BCD
Combi 13 C
Combi 14 CD
Combi 15 D
I've tried writting a program using recursion but, it keeps missing out "AB D" DOH!
This is a real brain teaser (or Head F**K), so any help would be appreciated.
Cheers
Glyn