AlgorithmsGenerateSortedPermutationsT Method (IEnumerableT, IComparerT) |
Generates all the possible permutations of the items in collection, in lexicographical order. A
supplied IComparer<T> instance is used to compare the items.
Even if some items are equal, the same permutation will not be generated more than once. For example,
if the collections contains the three items A, A, and B, then this method will generate only the three permutations, AAB, ABA,
BAA.
Namespace: X3Platform.CollectionsAssembly: X3Platform.Support (in X3Platform.Support.dll) Version: 1.0.0.0 (2.0.0.0)
Syntaxpublic static IEnumerable<T[]> GenerateSortedPermutations<T>(
IEnumerable<T> collection,
IComparer<T> comparer
)
public:
generic<typename T>
static IEnumerable<array<T>^>^ GenerateSortedPermutations(
IEnumerable<T>^ collection,
IComparer<T>^ comparer
)
Parameters
- collection
- Type: System.Collections.GenericIEnumerableT
The collection of items to permute. - comparer
- Type: System.Collections.GenericIComparerT
The IComparer<T> used to compare the items.
Type Parameters
- T
- The type of items to permute.
Return Value
Type:
IEnumerableTAn IEnumerable<T[]> that enumerations all the possible permutations of the
items in
collection. Each permutations is returned as an array. The items in the array
should be copied if they need to be used after the next permutation is generated; each permutation may
reuse the same array instance.
See Also