Methods
(static) countPermutation(n, r) → {number}
Counts the number of permutations using n permutate r (nPr).
Parameters:
Name | Type | Description |
---|---|---|
n |
number | The n value in nPr |
r |
number | The r value in nPr |
- Source:
Returns:
Numerical value representing the evaluation of nPr
- Type
- number
(static) factorial(n) → {number}
Evaluates a factorial n.
Parameters:
Name | Type | Description |
---|---|---|
n |
number | Factorial to evaluate |
- Source:
Returns:
Result of the factorial evaluation
- Type
- number
(static) kPermutations(inArr, k) → {Array.<Array.<number>>}
Finds all possible permutations of length k in a given array.
Parameters:
Name | Type | Description |
---|---|---|
inArr |
Array.<number> | The input array to permutate |
k |
number | The length of output arrays |
- Source:
Returns:
Array of arrays representing all permutations of k length.
- Type
- Array.<Array.<number>>
(static) permutation(inArr) → {Array.<Array.<number>>}
Finds all possible permutations of in a given array.
Parameters:
Name | Type | Description |
---|---|---|
inArr |
Array.<number> | The input array to permutate |
- Source:
Returns:
Array of arrays representing all permutations.
- Type
- Array.<Array.<number>>