Hello,
I had a problem: make sequence of random permutations which elements do not occur in same positions. E.g. I have list ('a', 'b', 'c', 'd'). I randomly generate permutation, say 'a d b c', then next permutation, say 'd c a b, then next permutation can not start with 'a' and 'd', because these elements occurs in first or second sequence on same position.
My algorithm is slow: I repeat to generate random (with Fisher-Yates shuffle) permutation and check each element if it not occur in previous sequences (I used 2D array). How to determine what is the complexity of my algorithm?
How to solve problem faster?