Permutations with repetitions

From Rosetta Code
Revision as of 09:46, 26 April 2013 by rosettacode>NevilleDNZ ('''See Also:''' {{Template:Combinations and permutations}} - has this been done in another task somewhere else?)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Permutations with repetitions is a draft programming task. It is not yet considered ready to be promoted as a complete task, for reasons that should be found in its talk page.
Permutations with repetitions is a draft programming task. It is not yet considered ready to be promoted as a complete task, for reasons that should be found in its talk page.

Generate a sequence of permutations of n elements drawn from choice of k values.

This sequence will have elements, unless the program decides to terminate early.

Do not store all the intermediate values ion the sequence, rather generate them as required, and pass the intermediate result to a deciding routine.

For example: When "cracking" a "combination" lock a sequence is required, but the sequence is terminated once a successful "combination" is found. This case is a good example of where it is not required to store all the intermediate 'permutations.

See Also:

The number of samples of size k from n objects.

With   combinations and permutations   generation tasks.

Order Unimportant Order Important
Without replacement
Task: Combinations Task: Permutations
With replacement
Task: Combinations with repetitions Task: Permutations with repetitions