![]() |
More Efficent Way of Generating Permutations/ w Rep - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: General Coding Help (https://python-forum.io/forum-8.html) +--- Thread: More Efficent Way of Generating Permutations/ w Rep (/thread-20610.html) |
More Efficent Way of Generating Permutations/ w Rep - ClassicalSoul - Aug-21-2019 Hi, My current method of generating permutations with repetition is to first generate all combinations with repetition, then find the permutations (w/out repetition) of each combination, and lastly to remove all copies. Can anyone suggest a more efficient way of doing this? Sorry I can't provide source code... I use Scheme/Lisp not Python (but I know this is a good site, so that's why I ask). RE: More Efficent Way of Generating Permutations/ w Rep - Gribouillis - Aug-22-2019 What about the solutions in 35 programming languages from rosetta code? Edit: hmm, I'm not sure they are so good after all... RE: More Efficent Way of Generating Permutations/ w Rep - perfringo - Aug-22-2019 In Python built-in module itertools is permutations() function. |