import java.util.*; /* t1 t2 t3 ....... tn 1 1 1 2 2 2 3 3 4 n is variable . And number of elements in each ti are also variable. output should be all combinations of elements taken from each ti at a time e.g output 1 1 1 1 1 2 1 1 3 1 1 4 1 2 1 1 2 2 1 2 3 1 2 4 2 1 1 2 1 2 ... and so on */ // problem defn: size of T is variable. and the vectors present in T are also of variable sizes public class TestingRecurse { public Vector t; // T is a vector of vectors public Vector parcel; // a vector of Strings public static void main(String args[]) { TestingRecurse tr = new TestingRecurse(); tr.t = new Vector(); Vector temp; // a vector of Strings String a = new String("a"); String b = new String("b"); String c = new String("c"); String d = new String("d"); String e = new String("e"); temp = new Vector(); temp.add(a); temp.add(b); temp.add(c); temp.add(d); tr.t.add(temp); temp = new Vector(); temp.add(a); temp.add(b); tr.t.add(temp); temp = new Vector(); temp.add(a); temp.add(b); temp.add(c); temp.add(d); temp.add(e); tr.t.add(temp); int tSize = tr.t.size(); tr.parcel = new Vector(tSize); for(int i=0;i=0;i--) { arr[i][1] = ((Vector)tr.t.get(i)).size(); arr[i][0] = pr; pr *= arr[i][1]; } for(int j=0;j