c++ - Generating all permutations with repetition -


how generate possible permutations of n (given) distinct items taken r @ time item can repeated number of times?

combinatorics tell me there n^r of them, wondering how generate them c++/python?

treat permutation r-digit number in n-based numerical system. start 000...0 , increase 'number' one: 0000, 0001, 0002, 000(r-1), 0010, 0011, ...

the code quite simple.


Comments

Popular posts from this blog

java - Jmockit String final length method mocking Issue -

asp.net - Razor Page Hosted on IIS 6 Fails Every Morning -

c++ - wxwidget compiling on windows command prompt -