Hi experts.
I need to generate some test data for an experiment im doing. The following explanation of what im trying to do is very abstract, I just need to get a simple algorithm working in java that does this, then I can change it accordingly (i.e. the strings/characters for the permutations will actually be some data coming out of a database).
Imagine I have a list of strings or characters {x, y, z}
I need to generate all permutations of the list, each permutations length is dependent on a parameter which I will be providing as input to the algorithm.
i.e. if I invoke the algorithm with the input 2, I get the permutations:
X, X
X, Y
X, Z
Y, Y
Y, X
Y, Z
Z, Z
Z, X
Z, Y
so the input number is the 'length' of each permutation
Can someone help me to create an algorithm for this, if its in pseudo code thats fine, as I can translate it into Java myself
by: a_bPosted on 2009-09-28 at 04:34:11ID: 25438296
http://www.velocityreviews .com/forum s/t131940- permutatio ns- of-inst ances-in-a rray.html