I have an array U
of arrays D
that vary in length. I need to be able to return all permutations of array indices that would select a different permutation consisting of 1 element from each set. I also require that this alorithm gets represented as an object that only remembers the last permutation, and returns the next permutation with a get_next method.
For instance, U = [array_of_size_n1, array_of_size_n2, array_of_size_n3]
There would be n1*n2*n3
permutations, each 3 elements long.
Edit: the number of sets also varies.