Discrete math algorithm - Combinations of combinations of arrays
I've spent more than 3 days now trying to write an algorithm to do this, but can't find a way... That D is discrete structure in college is coming back to haunt me now I guess...
Trying to find an algorithm to generate all combinations, of all combinations, of n arrays. I found a decent class on the net (google: java array combinations) that generates combinations of a single array taken n at a time, and it was simple enought to adapt it to give all combinations from length 1-array.length.
See example below for possible output;
String[] t = {"X","Y","Z"};
String[] r = {"A","B","C"};
String[] j = {"P","Q","R"};
// generate all combinations of all combinations of all arrays
// ex (line breaks for clarity only)
// X, Y, Z, XY, XZ, YZ, XYZ
// A, B, C, AB, AC, BC, ABC
// P, Q, R, PQ, PR, QR, PQR
// XA, XB, XC, XAB, XAC, XBC, XABC
// XP, XQ, XR, XPQ, XQR, XPQR
// YA, YB, YC, YAB, YAC, YBC, YABC
// YP, YQ, YR, YPQ, YQR, YPQR
// ...
// XAP, XAQ, XAR, XAPQ, XAPR, XAQR, XAPRQ
// ...
// XYZABCP, XYZABCQ, XYZABCR, XYZABCPQ, XYZABCPR, XYZABCQR, XYZABCPQR
// done

