0

I imagine I have a set of n objects. I know k1 many of them are of type 0, k2 many of type 1 and k3 many of type 2 such that n=k1+k2+k3.

I am looking for a loop that takes me through all possible permutations of these n objects, i.e. in each iteration I want a vector of length n such that each entries specifies a number 0,1,2, specifying the type of the i-th element.

What is an elegant way to implement this?

Guido
  • 101
  • 1
    Does this answer your question? [How to generate all permutations of a list?](https://stackoverflow.com/questions/104420/how-to-generate-all-permutations-of-a-list) – 500 - Internal Server Error Apr 13 '22 at 23:37
  • *an elegant way* - Did you try it? If yes, please hare your attempt and specify what difficulties you've encountered or why you are not satisfied with your solution. – Alexander Ivanchenko Apr 14 '22 at 16:39

0 Answers0