I am studying a circuit and I am trying to create permutations with repetitions of a certain size.
For example, given n = 4 and setting S = {a, b, c, d, e, f}, I would like to generate all possible permutations: {a, a, a, a}, {a, a, a, b }, ..., {a, a, a, e}, {a, a, b, a}, {a, a, b, b}, ..., {a, a, B, F}, ... {e, a, a, a}, {e, a, a, b} ..., {F, A, A, F}, ... {F, F, F, F}.
The trouble is that I canβt understand how to choose βaβ 4 times, and remember that I selected it 4 times, then select βaβ 3 times and βbβ once and remember all this, so I donβt choose him again.
I know that these problems are best solved with the help of recursive algorithms, but it just complicates the situation, for example, as I remember in recursion, which elements I chose.
I do not know how to approach this problem at all. I would be very happy if someone wrote a thought process to solve this problem. I would really appreciate it!
Please help me.
Thanks, Boda Sido.