Talk:Permutations with some identical elements: Difference between revisions

From Rosetta Code
Content added Content deleted
m (fixed placement of HTML tags.)
m (→‎task wording: used a true ellipsis.)
Line 20: Line 20:
would it be better with:
would it be better with:


Given an input of the form &nbsp; <big>[a1, a2, ..., ak]</big> &nbsp; where &nbsp; <big>a<sub>k</sub></big> &nbsp; denotes how many duplicates of element &nbsp; <big>k</big> &nbsp; you should have,
Given an input of the form &nbsp; <big>[a1, a2, ···, ak]</big> &nbsp; where &nbsp; <big>a<sub>k</sub></big> &nbsp; denotes how many duplicates of element &nbsp; <big>k</big> &nbsp; you should have,
each &nbsp; <big>a<sub>k</sub> &gt; 0</big> &nbsp; and the sum of all &nbsp; <big>a<sub>k</sub></big> &nbsp; is &nbsp; <big>'''n'''</big>.
each &nbsp; <big>a<sub>k</sub> &gt; 0</big> &nbsp; and the sum of all &nbsp; <big>a<sub>k</sub></big> &nbsp; is &nbsp; <big>'''n'''</big>.



Revision as of 04:02, 27 July 2019

Duplicate of Permutations with repetitions

Seems to me this exact operation is covered by the existing (for 6 years!) Permutations_with_repetitions task. --Thundergnat (talk) 19:32, 25 July 2019 (UTC)

I don't think so.He wants to create the permutation of different elements in which each element has its own constant multiplicity in this permutation. His example: [2,1] ( element 1 two times und element 2 1 time ) should give results (1,1,2), (1,2,1) and (2,1,1)

Horst.h

I don't think the permutations_with_repetitions task is about permutations at all, but rather generating all possible sequences (words) of a certain length from an alphabet, where each symbol may be repeated an infinite amount of times as needed.

This task is instead about creating all sequences of a finite set of elements where some elements are indistinguishable from each other.

Yes, you're right; it is different. I've added a Go solution --PureFox (talk) 21:27, 25 July 2019 (UTC)


task wording

Where it says:

   Given an input of the form [a1, a2, ..., ak] where ai denotes how many duplicates of element i you should have, 
   each ai > 0 and the sum of all ai is n.

would it be better with:

   Given an input of the form   [a1, a2, ···, ak]   where   ak   denotes how many duplicates of element   k   you should have, 
   each   ak > 0   and the sum of all   ak   is   n.


(I've added whitespace and used a bigger font to make the subscripts easier to read.)     -- Gerard Schildberger (talk) 03:51, 27 July 2019 (UTC)