combinatorics - Static sized permutations from Dynamic sized set -
How can I get all the combinations for a list where the size of the composition is static only like if there are 4 elements in the list It will only require permutations of lengths of 4, 3, 2 and 1. I'm guessing that it will require recycling. Unique combinations can be helpful but I would like to see it as the easiest (no specificity) form for my dog's power.
set s = {x1, x2, x3, x4}; Array solution; Permume (I) = & gt; If (I == 0) => Print and return; While the unused element in the set = & gt; Taking element from set which is not in the solution; Put the element into the solution; Sequence (i - 1); Remove the element from the solution; If you want a more specific answer, you will need to create more specific questions. Show some code / attempts / whatever.
Comments
Post a Comment