I am stuck on the following problem. I want to find an algorithm that finds all possible permutations of a certain numbers of distinct digits and then put them in a large matrix for instance. For instance for the digits 0, 1 and 2 I want to get the matrix:2 1 2 0 1 01 2 0 2 0 10 0 1 1 2 2Here they are in order but this is not required per se. Does anyone know a nice algorithm to achieve this? Thanks in advance.
finds all possible permutations of a certain numbers of distinct digits
algorithms