Combinatorics
binomial (n: number, k: number): number
Calculates the binomial coefficient nCk of two numbers n and k.
Name | Type | Default | Description |
---|---|---|---|
n | number | ||
k | number |
factorial (x: number): number
Calculates the factorial of a number x.
Name | Type | Default | Description |
---|---|---|---|
x | number |
permutations (arr: Array<T>): Array<Array<T>>
Returns an array of all possible permutations of an input array arr. In this implementation, we always have permutations(arr)[0] == arr. From http://stackoverflow.com/questions/9960908/permutations-in-javascript
Name | Type | Default | Description |
---|---|---|---|
arr | Array<T> |